nblog_duo 111.120.002 → 111.120.003
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/nblog_duo.rb +16 -12
- 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: 86ab7a8651d203747ab15ea4cca81b769adfec5c0e7c0cc10636b14a8daea03a
|
4
|
+
data.tar.gz: 0df26f49762720cdc20d17b8d4943539db9aa51b31161c6fc0268bdee600f6d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553ce970ce17140182002e176f8eaa14a2d9e426dc5fdd9bd003ae9f749088a08b318092fcf1b51c69e142d57491927f8213755819dee32970cf770b81c2284a
|
7
|
+
data.tar.gz: 65ad848b5e5e2a90cc97502afa5f5186463e9b6028c380e6191a3ccea8a44be9cd1ffd2bb9dc2c1e03ff3e70669a2f9eaaae033e8239902bed9e186759b6bd83
|
data/lib/nblog_duo.rb
CHANGED
@@ -2317,20 +2317,24 @@ class Wordpress
|
|
2317
2317
|
width = img.columns
|
2318
2318
|
height = img.rows
|
2319
2319
|
|
2320
|
+
if height > width
|
2321
|
+
min_height = (width * min_crop_ratio).to_i
|
2322
|
+
new_height = rand(min_height..width)
|
2323
|
+
crop_top = ((height - new_height) / 2.0).round
|
2320
2324
|
|
2325
|
+
cropped = img.crop(0, crop_top, width, new_height, true)
|
2321
2326
|
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
end
|
2327
|
+
retries = 0
|
2328
|
+
begin
|
2329
|
+
cropped.write(path)
|
2330
|
+
rescue => e
|
2331
|
+
retries += 1
|
2332
|
+
puts "이미지 저장 오류 (#{e.message}), 재시도 #{retries}/5"
|
2333
|
+
sleep(1)
|
2334
|
+
retry if retries < 5
|
2335
|
+
raise "이미지 저장 실패: #{e.message}"
|
2336
|
+
end
|
2337
|
+
end
|
2334
2338
|
end
|
2335
2339
|
|
2336
2340
|
def auto_image(keyword = nil)
|