wp_posting_duo 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_duo.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d37afe94998d4fe7790a089cf2933981e3f47dcbbafaa14eaebf519c13a320f1
4
- data.tar.gz: a3dbecbfec0015c77b21479608a07e162f0c2d11682e6211d5979112c4f5f30a
3
+ metadata.gz: 06450a5281e0dd2b80e5cbce3d850b5f42286b525dec3f0929476be1356d3e35
4
+ data.tar.gz: 212bbd79860449e789f40b6b95fa54f5ee4c3ce99d9b877ba854491ed94c3431
5
5
  SHA512:
6
- metadata.gz: 6f08c0dbe970e493905b25fc11c999adfdb328b81a73f4c4104944df15ef3da649b76c946f5738e54817f4bf1655809225cad763bc3ff964fd53575aaad5d0c2
7
- data.tar.gz: d2513345da4eb89aafebdf313199db6fb73e64b3c64dbe38f9e3e2f28b115ad7e75fcc7a2bebbe87557d024a72ea6cec66a202f4371bd6ad3302828723c6b975
6
+ metadata.gz: ca9f5c1b8fdeaf8f44457f92331bab29be2c10058deeea5cbc70c0a8b3ea3ab2c43554c5e9aee1e4a7a2fea67e72534f0d39b83617843148edf1aa1c975a5986
7
+ data.tar.gz: 56f7d211330c42f1cdd4bc2a3ea921e05abc2827815631572b0fc638e21e046c3879f6ad4da130e29c2fe8497d5eb2796d8e1ee06eeb966ae4c14f18192bf01a
@@ -404,24 +404,28 @@ class Wordpress
404
404
  end
405
405
 
406
406
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
407
- img = Magick::Image.read(path).first
408
- width = img.columns
409
- height = img.rows
410
-
411
-
407
+ img = Magick::Image.read(path).first
408
+ width = img.columns
409
+ height = img.rows
412
410
 
413
- if height > width
414
- min_height = (width * min_crop_ratio).to_i
415
- new_height = rand(min_height..width)
416
- crop_top = ((height - new_height) / 2.0).round
411
+ if height > width
412
+ min_height = (width * min_crop_ratio).to_i
413
+ new_height = rand(min_height..width)
414
+ crop_top = ((height - new_height) / 2.0).round
417
415
 
418
- cropped = img.crop(0, crop_top, width, new_height, true)
419
- cropped.write(path)
416
+ cropped = img.crop(0, crop_top, width, new_height, true)
420
417
 
421
-
422
- else
423
-
424
- end
418
+ retries = 0
419
+ begin
420
+ cropped.write(path)
421
+ rescue => e
422
+ retries += 1
423
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
424
+ sleep(1)
425
+ retry if retries < 5
426
+ raise "이미지 저장 실패: #{e.message}"
427
+ end
428
+ end
425
429
  end
426
430
 
427
431
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wp_posting_duo
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