cafe_buy 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.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f94b7d1bcfb6264a812baed1a521a2f8f4ddf2724b49520f03db280675989019
4
- data.tar.gz: a85ba553efe2bdc42104ca639ecc5d67035b4e74a1a87db6873ba082d1d7c4a7
3
+ metadata.gz: 377206e549689ca46032b752398b86bddfdb202779e465a904faaf90045c5ab6
4
+ data.tar.gz: a59c83c0b4ab6966c9c039caa7eb5aa82834bd85a95518e9b1ee637a2418882f
5
5
  SHA512:
6
- metadata.gz: bc56b9eff065ad14f45f3ad5711e8cf1a6a5b0c8305e587454c3ed0c4ac749e9cedb668329ff84c66596f49cffa1e50bce12d2b0af7889c939e1bc49f87c6b52
7
- data.tar.gz: 61bccdfb975cd969708c6729066408476b70ccd79f7df844c87fbb32ac67374725e3aff811d8e7fbc8ef002f913de8184434df30b73f7d036502ae1901ddeb2e
6
+ metadata.gz: b37d8f1d406ec35b5ae6dd9cf68b4d757c43f2297921c36aedafdda45a8d6fc478cc557afdfe16a970f54948162b6a6ddc0d9913609c349223ce466de2d859a1
7
+ data.tar.gz: 0a66c5866111aaad5471e8e024662a1d3d881496691a86b71c86d2589849f69f1f03d98626b13697b575a54e68294d54c914bf996cb6f7698cd8134ec3608022
data/lib/cafe_buy.rb CHANGED
@@ -2367,24 +2367,28 @@ class Wordpress
2367
2367
 
2368
2368
 
2369
2369
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
2370
- img = Magick::Image.read(path).first
2371
- width = img.columns
2372
- height = img.rows
2373
-
2374
-
2370
+ img = Magick::Image.read(path).first
2371
+ width = img.columns
2372
+ height = img.rows
2375
2373
 
2376
- if height > width
2377
- min_height = (width * min_crop_ratio).to_i
2378
- new_height = rand(min_height..width)
2379
- crop_top = ((height - new_height) / 2.0).round
2374
+ if height > width
2375
+ min_height = (width * min_crop_ratio).to_i
2376
+ new_height = rand(min_height..width)
2377
+ crop_top = ((height - new_height) / 2.0).round
2380
2378
 
2381
- cropped = img.crop(0, crop_top, width, new_height, true)
2382
- cropped.write(path)
2379
+ cropped = img.crop(0, crop_top, width, new_height, true)
2383
2380
 
2384
-
2385
- else
2386
-
2387
- end
2381
+ retries = 0
2382
+ begin
2383
+ cropped.write(path)
2384
+ rescue => e
2385
+ retries += 1
2386
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
2387
+ sleep(1)
2388
+ retry if retries < 5
2389
+ raise "이미지 저장 실패: #{e.message}"
2390
+ end
2391
+ end
2388
2392
  end
2389
2393
 
2390
2394
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy
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