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.
- checksums.yaml +4 -4
- data/lib/posting_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: d97831616e7ec907b3436b8c83190a6a4926831a1b25d726252a24dd2782b4d3
|
4
|
+
data.tar.gz: 8675c35303597bf8660dd694859a2c0172eef25d3ba60e441b30f100077caf5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
12989
|
-
|
12990
|
-
|
12991
|
-
|
12992
|
-
|
12988
|
+
img = Magick::Image.read(path).first
|
12989
|
+
width = img.columns
|
12990
|
+
height = img.rows
|
12993
12991
|
|
12994
|
-
|
12995
|
-
|
12996
|
-
|
12997
|
-
|
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
|
-
|
13000
|
-
cropped.write(path)
|
12997
|
+
cropped = img.crop(0, crop_top, width, new_height, true)
|
13001
12998
|
|
13002
|
-
|
13003
|
-
|
13004
|
-
|
13005
|
-
|
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)
|