wp_posting_zon 0.0.10 → 0.0.11

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/wp_posting_zon.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f04627d200e810ce3c8d7a486338588d2a250af9637a6518e9fc138b920ef044
4
- data.tar.gz: 07c3abc9d388f1fa21cb2a44de1e7abd96b7a64b7bb4c95367b1a6b938f042d2
3
+ metadata.gz: 96784a9f76ad6736a6f5086d1c14f7735bcea379699ecf542db5c7fa42502814
4
+ data.tar.gz: 77600b5c96942ea4469a72a56101107bc841ced2b10c124647ed0db7576768e5
5
5
  SHA512:
6
- metadata.gz: 1ac9e938a5db2569f5b017031ce81ef7431f8908c0b657abf9cee6d9f1922836e77a63038ef26a07492b12acf6c6c7a1ff51e31ecf2108c313c6a9d16aa872bc
7
- data.tar.gz: 77a94363459c89ee91ae980405118f96267aad62d9c872269b093212545c2d551b07caad7323f1f849a46199136716278a97c25a6495b178a3da39fbbdf0ed70
6
+ metadata.gz: 7861d95cdc3e962f62dc689b6457804a2cfb390aaafb7e336db41e5912f5ffc1953fb8e230407748f138c74c0c2e0473a9e2c697876872a293bcc3841766a2f9
7
+ data.tar.gz: 96b14cb33e9baf058feb892123ae9f4f7417e90a53dac1b42c11ad1f087af9ee877a5dabd3ca8a46e526d089fbe228adf61fb275bc67fe4bdc0b70bc6cca976d
@@ -339,24 +339,28 @@ class Wordpress
339
339
  end
340
340
 
341
341
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
342
- img = Magick::Image.read(path).first
343
- width = img.columns
344
- height = img.rows
345
-
346
-
342
+ img = Magick::Image.read(path).first
343
+ width = img.columns
344
+ height = img.rows
347
345
 
348
- if height > width
349
- min_height = (width * min_crop_ratio).to_i
350
- new_height = rand(min_height..width)
351
- crop_top = ((height - new_height) / 2.0).round
346
+ if height > width
347
+ min_height = (width * min_crop_ratio).to_i
348
+ new_height = rand(min_height..width)
349
+ crop_top = ((height - new_height) / 2.0).round
352
350
 
353
- cropped = img.crop(0, crop_top, width, new_height, true)
354
- cropped.write(path)
351
+ cropped = img.crop(0, crop_top, width, new_height, true)
355
352
 
356
-
357
- else
358
-
359
- end
353
+ retries = 0
354
+ begin
355
+ cropped.write(path)
356
+ rescue => e
357
+ retries += 1
358
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
359
+ sleep(1)
360
+ retry if retries < 5
361
+ raise "이미지 저장 실패: #{e.message}"
362
+ end
363
+ end
360
364
  end
361
365
 
362
366
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wp_posting_zon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon