tblog_duopack 0.0.53 → 0.0.55

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/tblog_duopack.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a7bae240113c68c4b89024c456e78eacdc3f64af192ce1bda0d7587229297c6
4
- data.tar.gz: 997b8630952fe379fd09e480582bd17c4246c94bfe713497461206bc4c5375dd
3
+ metadata.gz: 0e127c468134d59313a08b01c510cba01b709a57742decbfc90b92166922a842
4
+ data.tar.gz: 48474e478f91851dbe2d3f77eec084b0b787304e3042a84ab8c0a129ad12fbac
5
5
  SHA512:
6
- metadata.gz: 291fab89eb49561eda99ec5624ebeb1d9c867d73d2db3a0e7a8c393c9db7e2ec71d2035e9e72d54df2d7093ed4ad96f4b10e960a97925252b54023c32b8fa998
7
- data.tar.gz: c3f235ed4d9d64550b27daf17834042186d1bf6bbe4a146e1f632f63c319eb66148a2b77b485cd8e8a1a8e1e289da3282a06bbbebe4d2948d65a7d7bfaad1840
6
+ metadata.gz: 29860a76946a9a4ba394e9c1154589625dca96ac0c18771cecd6dadca13638a3432af203d01de0f2734165d89dc3df2e4a17f406a0fffb77de6321fbe6a95cca
7
+ data.tar.gz: 013a0938da6ff2565ac2bf2319e7609bd1e3e3c40c8a7371e1bc822b98c5afbc3b606c89cf8733e57d76c09d26e6466bf03423fba6efacd9d6b88b62ae82e7b3
data/lib/tblog_duopack.rb CHANGED
@@ -1757,24 +1757,28 @@ class Wordpress
1757
1757
 
1758
1758
 
1759
1759
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
1760
- img = Magick::Image.read(path).first
1761
- width = img.columns
1762
- height = img.rows
1763
-
1764
-
1760
+ img = Magick::Image.read(path).first
1761
+ width = img.columns
1762
+ height = img.rows
1765
1763
 
1766
- if height > width
1767
- min_height = (width * min_crop_ratio).to_i
1768
- new_height = rand(min_height..width)
1769
- crop_top = ((height - new_height) / 2.0).round
1764
+ if height > width
1765
+ min_height = (width * min_crop_ratio).to_i
1766
+ new_height = rand(min_height..width)
1767
+ crop_top = ((height - new_height) / 2.0).round
1770
1768
 
1771
- cropped = img.crop(0, crop_top, width, new_height, true)
1772
- cropped.write(path)
1769
+ cropped = img.crop(0, crop_top, width, new_height, true)
1773
1770
 
1774
-
1775
- else
1776
-
1777
- end
1771
+ retries = 0
1772
+ begin
1773
+ cropped.write(path)
1774
+ rescue => e
1775
+ retries += 1
1776
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
1777
+ sleep(1)
1778
+ retry if retries < 5
1779
+ raise "이미지 저장 실패: #{e.message}"
1780
+ end
1781
+ end
1778
1782
  end
1779
1783
 
1780
1784
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tblog_duopack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.53
4
+ version: 0.0.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon