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.
- checksums.yaml +4 -4
- data/lib/tblog_zon.rb +19 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 674cd1bee02e91efd1d217ace77de8cc5143aadf9e97a7d1e6a3a37287100602
|
4
|
+
data.tar.gz: 5865b2572fb16ab3826fa78ff6b6e58017f558a855e2216dae05b5b00aa90b26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1690
|
+
img = Magick::Image.read(path).first
|
1691
|
+
width = img.columns
|
1692
|
+
height = img.rows
|
1695
1693
|
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
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
|
-
|
1702
|
-
cropped.write(path)
|
1699
|
+
cropped = img.crop(0, crop_top, width, new_height, true)
|
1703
1700
|
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
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)
|