tblog_zon 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_zon.rb +19 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa1ad9cb927ec2743efa587ddda0a06eeb591c0e0f4c976a0d92fe25e1874c22
4
- data.tar.gz: a2882c08f99a54cbbe163673f472cf5a2a33820051cfc02b28d2c5f377084b16
3
+ metadata.gz: 674cd1bee02e91efd1d217ace77de8cc5143aadf9e97a7d1e6a3a37287100602
4
+ data.tar.gz: 5865b2572fb16ab3826fa78ff6b6e58017f558a855e2216dae05b5b00aa90b26
5
5
  SHA512:
6
- metadata.gz: 24287751283bec290c7ab9984ee8eb64e6002f8c3eaa14db944b79833f8f67f70d1ee2970e61bed97e5cf487ff3e3b9b254b0a7c7aeed08ec85ff694d7a7fcb4
7
- data.tar.gz: db253bf93a78bb2a9c4de333cde553e8d5019713e63415ebffab7bc2062640bb0bdada64841a9681e292dca77b7884e66fd417f6f487412d5530c571fb8adba2
6
+ metadata.gz: 24c84d17c6f9a35a7e4d07427c79a702fa0177d496574902c2f5036c61ca6be639484fb10166afb730c0e3800c52a22e56e0ad0e37aac88aa2e5960f9a02bc8c
7
+ data.tar.gz: c7c75c38c0c962a3d4eac1da29b5d036465a623c1e9d7a60a73dcb66ac1ee99d082f9dad08e2f7de284b8fe438dd468fbbc29bf737f19dc43604fcd9be622824
data/lib/tblog_zon.rb CHANGED
@@ -1687,24 +1687,28 @@ class Wordpress
1687
1687
 
1688
1688
 
1689
1689
  def crop_image_height_under_width(path, min_crop_ratio = 0.625)
1690
- img = Magick::Image.read(path).first
1691
- width = img.columns
1692
- height = img.rows
1693
-
1694
-
1690
+ img = Magick::Image.read(path).first
1691
+ width = img.columns
1692
+ height = img.rows
1695
1693
 
1696
- if height > width
1697
- min_height = (width * min_crop_ratio).to_i
1698
- new_height = rand(min_height..width)
1699
- crop_top = ((height - new_height) / 2.0).round
1694
+ if height > width
1695
+ min_height = (width * min_crop_ratio).to_i
1696
+ new_height = rand(min_height..width)
1697
+ crop_top = ((height - new_height) / 2.0).round
1700
1698
 
1701
- cropped = img.crop(0, crop_top, width, new_height, true)
1702
- cropped.write(path)
1699
+ cropped = img.crop(0, crop_top, width, new_height, true)
1703
1700
 
1704
-
1705
- else
1706
-
1707
- end
1701
+ retries = 0
1702
+ begin
1703
+ cropped.write(path)
1704
+ rescue => e
1705
+ retries += 1
1706
+ puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
1707
+ sleep(1)
1708
+ retry if retries < 5
1709
+ raise "이미지 저장 실패: #{e.message}"
1710
+ end
1711
+ end
1708
1712
  end
1709
1713
 
1710
1714
  def auto_image(keyword = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tblog_zon
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