balloon 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/balloon/processing.rb +11 -10
- data/lib/balloon/version.rb +1 -1
- 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: 89bc6b2f3af3d0f77235b2ca38bc17851f0a3850a4742d14dfb462d5d32fb11d
|
4
|
+
data.tar.gz: f110eedc9a0e2ba8dde12785401755c0b4f5e264c707a4184dd35ca1a0e88aee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1228ab4477df6a100db7046cffb4436775e8f851db17009fdb18b90a645b4eeb2e7cdfc48cb6cdfaff32af44dc73f4c6ae33a4968b8cd0f583a622d715662097
|
7
|
+
data.tar.gz: 60473bbaf1ab5804eb39e23d6f2577fd475c445d82486605696e34b43026a67c5f5c7ab7cd05c04e1c646c51b9594daf28576b94d2336006bcda4c90d9477fd4
|
data/lib/balloon/processing.rb
CHANGED
@@ -15,8 +15,8 @@ module Balloon
|
|
15
15
|
processed_img = handle_original(image, ext)
|
16
16
|
data[:original] = get_image_data(processed_img)
|
17
17
|
|
18
|
-
|
19
|
-
data.
|
18
|
+
total_size = handle_resize(image, ext, data)
|
19
|
+
data[:total_size] = processed_img.size.to_i + total_size.to_i
|
20
20
|
|
21
21
|
mime_type = processed_img.mime_type
|
22
22
|
extension = FileExtension.get_extension(mime_type)
|
@@ -45,14 +45,14 @@ module Balloon
|
|
45
45
|
cache_file = File.join(cache_path, "#{file.basename}.#{ext}")
|
46
46
|
convert << cache_file
|
47
47
|
convert.call
|
48
|
-
|
48
|
+
|
49
49
|
return MiniMagick::Image.open(cache_file)
|
50
50
|
end
|
51
51
|
|
52
|
-
def handle_resize(file, ext)
|
53
|
-
return
|
54
|
-
return
|
55
|
-
|
52
|
+
def handle_resize(file, ext, data)
|
53
|
+
return unless self.respond_to?(:uploader_size)
|
54
|
+
return if store_storage.to_s == "upyun" && upyun_is_image
|
55
|
+
total_size = 0
|
56
56
|
|
57
57
|
uploader_size.each do |size, o|
|
58
58
|
img = MiniMagick::Image.open(file.path)
|
@@ -71,13 +71,14 @@ module Balloon
|
|
71
71
|
|
72
72
|
processed_img = MiniMagick::Image.open(cache_file)
|
73
73
|
data[size] = get_image_data(processed_img)
|
74
|
+
total_size += processed_img.size
|
74
75
|
end
|
75
76
|
|
76
|
-
return
|
77
|
+
return total_size
|
77
78
|
end
|
78
79
|
|
79
80
|
def resize(convert, image, size)
|
80
|
-
width, height, symbol = size[:width], size[:height], size[:symbol]
|
81
|
+
width, height, symbol = size[:width], size[:height], size[:symbol]
|
81
82
|
|
82
83
|
if !symbol.empty? || width.match(/\%/) || height.match(/\%/)
|
83
84
|
if width == height
|
@@ -114,7 +115,7 @@ module Balloon
|
|
114
115
|
shave_off = ((w - h) / 2).round
|
115
116
|
convert.shave "#{shave_off}x0"
|
116
117
|
return
|
117
|
-
end
|
118
|
+
end
|
118
119
|
|
119
120
|
shave_off = ((h - w) / 2).round
|
120
121
|
convert.shave "0x#{shave_off}"
|
data/lib/balloon/version.rb
CHANGED