posting_duo 3.111.007 → 3.111.009

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/posting_duo.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1ead5167968b1689376e9ea5501fc7a87d07f2a4f5cb2b0049e10e7b97846e0
4
- data.tar.gz: c29c3beb15b304edd6543959e7280c2d59cf132295f3f8c31fde3e508fddd73a
3
+ metadata.gz: 2de9fc90acc311fc1b0668c0817520630508be88b1a8d733711dc58480e3983f
4
+ data.tar.gz: 764c7c616cda2e8a06ed156137c6f9522153c5ad10b031df42b62d1ca1e9e3fb
5
5
  SHA512:
6
- metadata.gz: 74e4df04fddc0c94b79dddda2e7068731b1359dfae5d0c01b6eff438956f97abc36f3fff48512beafacfca00fc4cd3f2c695975f1d1884edc30bf15404d1addf
7
- data.tar.gz: 33f88f58899356d9daa6bebc7444f84927a7a945d14ee2183eaed4cfe62e732ca23808aa32b90407b976500088edc90f62ae00263b55712a2ea6171b529ad71f
6
+ metadata.gz: e332ff7caf0e91784c075419f40ce0a134d676b686c2d2f6a686a5c07bb012d3ec9cd5b6325314d6ce2b3fbe767d4429062223ab9822578bcd97ac9adc9aa511
7
+ data.tar.gz: 18f66654de5c2ac718d6577f5414746ed6fe86904191c429aa3849bde947bd5808a7a8a259fc1a0a3b601b604800943c566e07bc46083fa1ef8262a9fb6a3816
data/lib/posting_duo.rb CHANGED
@@ -13088,24 +13088,28 @@ class Wordpress
13088
13088
 
13089
13089
 
13090
13090
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
13091
- img = Magick::Image.read(path).first
13092
- width = img.columns
13093
- height = img.rows
13094
-
13095
-
13091
+ img = Magick::Image.read(path).first
13092
+ width = img.columns
13093
+ height = img.rows
13096
13094
 
13097
- if height > width
13098
- min_height = (width * min_crop_ratio).to_i
13099
- new_height = rand(min_height..width)
13100
- crop_top = ((height - new_height) / 2.0).round
13095
+ if height > width
13096
+ min_height = (width * min_crop_ratio).to_i
13097
+ new_height = rand(min_height..width)
13098
+ crop_top = ((height - new_height) / 2.0).round
13101
13099
 
13102
- cropped = img.crop(0, crop_top, width, new_height, true)
13103
- cropped.write(path)
13100
+ cropped = img.crop(0, crop_top, width, new_height, true)
13104
13101
 
13105
-
13106
- else
13107
-
13108
- end
13102
+ retries = 0
13103
+ begin
13104
+ cropped.write(path)
13105
+ rescue => e
13106
+ retries += 1
13107
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
13108
+ sleep(1)
13109
+ retry if retries < 5
13110
+ raise "이미지 저장 실패: #{e.message}"
13111
+ end
13112
+ end
13109
13113
  end
13110
13114
 
13111
13115
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.111.007
4
+ version: 3.111.009
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon