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.
- checksums.yaml +4 -4
- data/lib/posting_duo.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: 2de9fc90acc311fc1b0668c0817520630508be88b1a8d733711dc58480e3983f
|
4
|
+
data.tar.gz: 764c7c616cda2e8a06ed156137c6f9522153c5ad10b031df42b62d1ca1e9e3fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
13092
|
-
|
13093
|
-
|
13094
|
-
|
13095
|
-
|
13091
|
+
img = Magick::Image.read(path).first
|
13092
|
+
width = img.columns
|
13093
|
+
height = img.rows
|
13096
13094
|
|
13097
|
-
|
13098
|
-
|
13099
|
-
|
13100
|
-
|
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
|
-
|
13103
|
-
cropped.write(path)
|
13100
|
+
cropped = img.crop(0, crop_top, width, new_height, true)
|
13104
13101
|
|
13105
|
-
|
13106
|
-
|
13107
|
-
|
13108
|
-
|
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)
|