posting_zon 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_zon.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99ae97fa37bd79f53e04e7a31d6d38e1a5438fbc840da05622d727ea4e440d3a
4
- data.tar.gz: d3d3322a3aac7fd5036a5e8f3ded59b2563f5c01af72d192923a08a7ade3ef69
3
+ metadata.gz: d97831616e7ec907b3436b8c83190a6a4926831a1b25d726252a24dd2782b4d3
4
+ data.tar.gz: 8675c35303597bf8660dd694859a2c0172eef25d3ba60e441b30f100077caf5e
5
5
  SHA512:
6
- metadata.gz: 7780eaa5c4321ef6e5ae65cc64fe8bdce9713e1030d0e70d57742f01ffda7b6110b7599a25a486033e76386148e4eb17233bce4bd9c3f85c8cf1d2c6a5e1d485
7
- data.tar.gz: 9a13712522d5fd50c0c5efdd268bf203dc8f7cb9b0beff77f2a9a86443cef271ceefe4b5ee831ba5b24fd8629d6acc89bc728750078743eefd19fc7725705ca2
6
+ metadata.gz: 4d86c7aeaaa15657abcaed690e7dda718cc3f3543c4aaec1dc698b7efdebd1bb67d3de04efa3f9b6b7d4313e4148ec46ed5217d789ac3b1c4652b8f11bb35bf2
7
+ data.tar.gz: 675574b6d37dcb59ee4cf13994767a68b6ff86f0d9d9b0055a1cb7f650b0aba5c51bf95be0305986498687a5a4faaf5fc18aab822f6a88827666298afaccc2a1
data/lib/posting_zon.rb CHANGED
@@ -12985,24 +12985,28 @@ class Wordpress
12985
12985
 
12986
12986
 
12987
12987
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
12988
- img = Magick::Image.read(path).first
12989
- width = img.columns
12990
- height = img.rows
12991
-
12992
-
12988
+ img = Magick::Image.read(path).first
12989
+ width = img.columns
12990
+ height = img.rows
12993
12991
 
12994
- if height > width
12995
- min_height = (width * min_crop_ratio).to_i
12996
- new_height = rand(min_height..width)
12997
- crop_top = ((height - new_height) / 2.0).round
12992
+ if height > width
12993
+ min_height = (width * min_crop_ratio).to_i
12994
+ new_height = rand(min_height..width)
12995
+ crop_top = ((height - new_height) / 2.0).round
12998
12996
 
12999
- cropped = img.crop(0, crop_top, width, new_height, true)
13000
- cropped.write(path)
12997
+ cropped = img.crop(0, crop_top, width, new_height, true)
13001
12998
 
13002
-
13003
- else
13004
-
13005
- end
12999
+ retries = 0
13000
+ begin
13001
+ cropped.write(path)
13002
+ rescue => e
13003
+ retries += 1
13004
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
13005
+ sleep(1)
13006
+ retry if retries < 5
13007
+ raise "이미지 저장 실패: #{e.message}"
13008
+ end
13009
+ end
13006
13010
  end
13007
13011
 
13008
13012
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_zon
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