cafe_basics_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_basics_duo.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60647955187b2b942307988080314021176bf5359a4899611fd88293402edc38
4
- data.tar.gz: 3d16d1ee3a8c39c168b031f4fcea42cf995981843523851f832b82f616d8e1ff
3
+ metadata.gz: 6b868b13d28d76acb532714d33421cd445eb6b369b1a369a80c3711f26fb995a
4
+ data.tar.gz: b4b5777cb76884c022ed55c6ab9c16a34b84e9a61db13923a1fd94da9ed1e50e
5
5
  SHA512:
6
- metadata.gz: fb237f7fb35781a4e4f04d83b224ff6b22fece83cee9dec8c39fa3e01178b6a8db18e3e9dc9e4e14fd33d444740b1173fbdff9031228948b093de450cf1032d3
7
- data.tar.gz: c06a8c8484d36289cab1c0efa7a5d1b1c557331c86a78e4539a92a1d89193c8034bfc6560753936109f364c6d5e82e654caf52cb7b523c2dd531f34c32fbcfcb
6
+ metadata.gz: 4b60c2de99e80f65a1b9bb4b0fc231c9c7ee0fb3fb5d81d5fdb20524391a047e6003bb188924aec1614c76936e6aa8941b31d5e2609e60c7eaff1160df4b0812
7
+ data.tar.gz: 4caf5a67d2c104a676c40e5c41dedef98c3aabcd276d8f3f36fc9ecc10d9328516caebbe998725d5a3394541aca32877638c44bf73f44d443e5693e71d8d459d
@@ -2097,24 +2097,28 @@ class Wordpress
2097
2097
 
2098
2098
 
2099
2099
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
2100
- img = Magick::Image.read(path).first
2101
- width = img.columns
2102
- height = img.rows
2103
-
2104
-
2100
+ img = Magick::Image.read(path).first
2101
+ width = img.columns
2102
+ height = img.rows
2105
2103
 
2106
- if height > width
2107
- min_height = (width * min_crop_ratio).to_i
2108
- new_height = rand(min_height..width)
2109
- crop_top = ((height - new_height) / 2.0).round
2104
+ if height > width
2105
+ min_height = (width * min_crop_ratio).to_i
2106
+ new_height = rand(min_height..width)
2107
+ crop_top = ((height - new_height) / 2.0).round
2110
2108
 
2111
- cropped = img.crop(0, crop_top, width, new_height, true)
2112
- cropped.write(path)
2109
+ cropped = img.crop(0, crop_top, width, new_height, true)
2113
2110
 
2114
-
2115
- else
2116
-
2117
- end
2111
+ retries = 0
2112
+ begin
2113
+ cropped.write(path)
2114
+ rescue => e
2115
+ retries += 1
2116
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
2117
+ sleep(1)
2118
+ retry if retries < 5
2119
+ raise "이미지 저장 실패: #{e.message}"
2120
+ end
2121
+ end
2118
2122
  end
2119
2123
 
2120
2124
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_basics_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