wp_posting_duo 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_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: 06450a5281e0dd2b80e5cbce3d850b5f42286b525dec3f0929476be1356d3e35
|
4
|
+
data.tar.gz: 212bbd79860449e789f40b6b95fa54f5ee4c3ce99d9b877ba854491ed94c3431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca9f5c1b8fdeaf8f44457f92331bab29be2c10058deeea5cbc70c0a8b3ea3ab2c43554c5e9aee1e4a7a2fea67e72534f0d39b83617843148edf1aa1c975a5986
|
7
|
+
data.tar.gz: 56f7d211330c42f1cdd4bc2a3ea921e05abc2827815631572b0fc638e21e046c3879f6ad4da130e29c2fe8497d5eb2796d8e1ee06eeb966ae4c14f18192bf01a
|
data/lib/wp_posting_duo.rb
CHANGED
@@ -404,24 +404,28 @@ class Wordpress
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def crop_image_height_under_width(path, min_crop_ratio = 0.625)
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
407
|
+
img = Magick::Image.read(path).first
|
408
|
+
width = img.columns
|
409
|
+
height = img.rows
|
412
410
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
411
|
+
if height > width
|
412
|
+
min_height = (width * min_crop_ratio).to_i
|
413
|
+
new_height = rand(min_height..width)
|
414
|
+
crop_top = ((height - new_height) / 2.0).round
|
417
415
|
|
418
|
-
|
419
|
-
cropped.write(path)
|
416
|
+
cropped = img.crop(0, crop_top, width, new_height, true)
|
420
417
|
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
418
|
+
retries = 0
|
419
|
+
begin
|
420
|
+
cropped.write(path)
|
421
|
+
rescue => e
|
422
|
+
retries += 1
|
423
|
+
puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
|
424
|
+
sleep(1)
|
425
|
+
retry if retries < 5
|
426
|
+
raise "이미지 저장 실패: #{e.message}"
|
427
|
+
end
|
428
|
+
end
|
425
429
|
end
|
426
430
|
|
427
431
|
def auto_image(keyword = nil)
|