cafe_buy_duo 0.1.52 → 0.1.53

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/cafe_buy_duo.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb6262162997d15877bbefc16791064e678caa15cba1fe4502669f9e1a4b58c2
4
- data.tar.gz: ae6f20b8fa94e6704f2e596749019afa47297e4757105ee55f07586c4f441609
3
+ metadata.gz: 385bc3207c8c11406b1a4334217f61a88631a28085a923a52fa8b17adb665257
4
+ data.tar.gz: c582a195fb18bed9a08b9cb0c7e2c109292e6341bf209974d412965d6ae90b99
5
5
  SHA512:
6
- metadata.gz: 4a07c7159f00755c9721322c8a4a0315717e4b4dce78d1ef5bf2960a5055c940fd33322b9a1bf04acc6e46f7e29500c8bfd485aa2439982ca8647db2bb95c4c7
7
- data.tar.gz: e73ef5468ac924cdeae86cc0263c1e2b99b15925dddcbeab5ca60ebaf3f684c003bb50fa67a575385c777ee1d11658b4f123e561aa405a79a235adcd89ab5b6c
6
+ metadata.gz: d9126d46589500b7ebf21dcb59117cde07a547ffdba727d7973588f762562807f5672c9ef0c3a1053dddbce1013f77bf2b6b93c000f57fd64db5148d9c77300b
7
+ data.tar.gz: 949882637008bafc25eaa2841c22bf95f8287b038e1b7244ac6ed74d646ec17c97069aa956ce568c3570474fd2c8fd00fa8f99d449e4bf1eef7316654ea86a93
data/lib/cafe_buy_duo.rb CHANGED
@@ -2435,24 +2435,28 @@ class Wordpress
2435
2435
 
2436
2436
 
2437
2437
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
2438
- img = Magick::Image.read(path).first
2439
- width = img.columns
2440
- height = img.rows
2441
-
2442
-
2438
+ img = Magick::Image.read(path).first
2439
+ width = img.columns
2440
+ height = img.rows
2443
2441
 
2444
- if height > width
2445
- min_height = (width * min_crop_ratio).to_i
2446
- new_height = rand(min_height..width)
2447
- crop_top = ((height - new_height) / 2.0).round
2442
+ if height > width
2443
+ min_height = (width * min_crop_ratio).to_i
2444
+ new_height = rand(min_height..width)
2445
+ crop_top = ((height - new_height) / 2.0).round
2448
2446
 
2449
- cropped = img.crop(0, crop_top, width, new_height, true)
2450
- cropped.write(path)
2447
+ cropped = img.crop(0, crop_top, width, new_height, true)
2451
2448
 
2452
-
2453
- else
2454
-
2455
- end
2449
+ retries = 0
2450
+ begin
2451
+ cropped.write(path)
2452
+ rescue => e
2453
+ retries += 1
2454
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
2455
+ sleep(1)
2456
+ retry if retries < 5
2457
+ raise "이미지 저장 실패: #{e.message}"
2458
+ end
2459
+ end
2456
2460
  end
2457
2461
 
2458
2462
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.52
4
+ version: 0.1.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon