wp_posting_zon 0.0.10 → 0.0.11
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/wp_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: 96784a9f76ad6736a6f5086d1c14f7735bcea379699ecf542db5c7fa42502814
|
4
|
+
data.tar.gz: 77600b5c96942ea4469a72a56101107bc841ced2b10c124647ed0db7576768e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7861d95cdc3e962f62dc689b6457804a2cfb390aaafb7e336db41e5912f5ffc1953fb8e230407748f138c74c0c2e0473a9e2c697876872a293bcc3841766a2f9
|
7
|
+
data.tar.gz: 96b14cb33e9baf058feb892123ae9f4f7417e90a53dac1b42c11ad1f087af9ee877a5dabd3ca8a46e526d089fbe228adf61fb275bc67fe4bdc0b70bc6cca976d
|
data/lib/wp_posting_zon.rb
CHANGED
@@ -339,24 +339,28 @@ class Wordpress
|
|
339
339
|
end
|
340
340
|
|
341
341
|
def crop_image_height_under_width(path, min_crop_ratio = 0.625)
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
342
|
+
img = Magick::Image.read(path).first
|
343
|
+
width = img.columns
|
344
|
+
height = img.rows
|
347
345
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
346
|
+
if height > width
|
347
|
+
min_height = (width * min_crop_ratio).to_i
|
348
|
+
new_height = rand(min_height..width)
|
349
|
+
crop_top = ((height - new_height) / 2.0).round
|
352
350
|
|
353
|
-
|
354
|
-
cropped.write(path)
|
351
|
+
cropped = img.crop(0, crop_top, width, new_height, true)
|
355
352
|
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
353
|
+
retries = 0
|
354
|
+
begin
|
355
|
+
cropped.write(path)
|
356
|
+
rescue => e
|
357
|
+
retries += 1
|
358
|
+
puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
|
359
|
+
sleep(1)
|
360
|
+
retry if retries < 5
|
361
|
+
raise "이미지 저장 실패: #{e.message}"
|
362
|
+
end
|
363
|
+
end
|
360
364
|
end
|
361
365
|
|
362
366
|
def auto_image(keyword = nil)
|