nblog_zon 111.120.002 → 111.120.003

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nblog_zon.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 595965e5f3c7b1d69d7c74b60132fdf593929cdae756140076d27e752b293262
4
- data.tar.gz: 120f11c6c018d9ce3f5c4fe0f6200cc26687343102895b9fea21d9d6b5051c64
3
+ metadata.gz: fe5bf260ce4df25706be5b4c50d08b9b31c50949b0e7ed6c17dbd6dbc566b622
4
+ data.tar.gz: 0d4b42bf5d55b0b553c6dede47877dc82b218b49c7deba4c2474cd59ab426cc1
5
5
  SHA512:
6
- metadata.gz: 98e94f6a657edf2483cb147d0685bf1f22e4778e4cd9cd25c78847e71e452dadc41b3ac39d3fffecd34a905808a5bf7bc8a6e74dafd21b2495588d0cf32d20a0
7
- data.tar.gz: fd9770bbc34d96c45c3cadd0a452ef31317cdad42ba6dc2466ec47783fc79ce1cfcf4de0f6daefb0acd9af9a2020dc1ff14ffcda7caa5e0dfdb3bc5c787ceb40
6
+ metadata.gz: '0870375b45d3327fc7b74eb96a86ccf16f3c9d0714f1c3f0942174af02a2f3bfcd4703f5f3bedfe7b1db225bec6d26ae9e9db11de602e20f4d486b29b9316482'
7
+ data.tar.gz: 3bece6f01d16968e558695f5d457809f90f5ae6c141e7c5ba908fcc34d490027111e8aa9e259d6486e9fc36be1c5963dd03eaeb384b69efc670cff976591b1a7
data/lib/nblog_zon.rb CHANGED
@@ -2241,24 +2241,28 @@ class Wordpress
2241
2241
  end
2242
2242
 
2243
2243
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
2244
- img = Magick::Image.read(path).first
2245
- width = img.columns
2246
- height = img.rows
2247
-
2248
-
2244
+ img = Magick::Image.read(path).first
2245
+ width = img.columns
2246
+ height = img.rows
2249
2247
 
2250
- if height > width
2251
- min_height = (width * min_crop_ratio).to_i
2252
- new_height = rand(min_height..width)
2253
- crop_top = ((height - new_height) / 2.0).round
2248
+ if height > width
2249
+ min_height = (width * min_crop_ratio).to_i
2250
+ new_height = rand(min_height..width)
2251
+ crop_top = ((height - new_height) / 2.0).round
2254
2252
 
2255
- cropped = img.crop(0, crop_top, width, new_height, true)
2256
- cropped.write(path)
2253
+ cropped = img.crop(0, crop_top, width, new_height, true)
2257
2254
 
2258
-
2259
- else
2260
-
2261
- end
2255
+ retries = 0
2256
+ begin
2257
+ cropped.write(path)
2258
+ rescue => e
2259
+ retries += 1
2260
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
2261
+ sleep(1)
2262
+ retry if retries < 5
2263
+ raise "이미지 저장 실패: #{e.message}"
2264
+ end
2265
+ end
2262
2266
  end
2263
2267
 
2264
2268
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nblog_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 111.120.002
4
+ version: 111.120.003
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon