balloon 1.1.6 → 1.1.7
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/balloon/file_extension.rb +12 -0
- data/lib/balloon/http/client.rb +1 -1
- data/lib/balloon/processing.rb +3 -3
- data/lib/balloon/uploader.rb +1 -1
- data/lib/balloon/version.rb +1 -1
- data/lib/balloon.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bba5d24f211be4448d34dd84ffbe355ea56a50fd6c5ac712ceb3237b662ed595
|
4
|
+
data.tar.gz: 2cc2eae99f948e15c60aa54a40439e341c53d5a15d5b9028e4bddc4bd2d8536c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f7a60fec492313632bebe0e2f0aff94793eb7be842345e3ac0d167eeccb5affaf756f8c6e94daa75b0a03298d0347c2d1f09a9c86d659964f1cb578c1674728
|
7
|
+
data.tar.gz: 3f58fca77193677d5b14e9c8902f918e9993ab2eeb7bdfbbb77545234d666c871d4daca443498aa31f6b232399c06ad812b58e703790e44a399492f90f39c534
|
@@ -29,6 +29,13 @@ module Balloon
|
|
29
29
|
["\xff\xd8\xff\xe1(.*){2}Exif", "image/jpeg"]
|
30
30
|
]
|
31
31
|
|
32
|
+
IMAGE_TYPE_LIST = {
|
33
|
+
"GIF" => "image/gif",
|
34
|
+
"JPEG" => "image/jpeg",
|
35
|
+
"PNG" => "image/png",
|
36
|
+
"WEBP" => "image/webp"
|
37
|
+
}
|
38
|
+
|
32
39
|
IMAGE_EXT_LIST = {
|
33
40
|
"image/gif" => "gif",
|
34
41
|
"image/jpeg" => "jpg",
|
@@ -134,6 +141,11 @@ module Balloon
|
|
134
141
|
end
|
135
142
|
end
|
136
143
|
|
144
|
+
def self.get_mime_type(type)
|
145
|
+
return type if type =~ /.+\/.+/
|
146
|
+
IMAGE_TYPE_LIST[type]
|
147
|
+
end
|
148
|
+
|
137
149
|
def self.get_extension(mime_type)
|
138
150
|
IMAGE_EXT_LIST[mime_type]
|
139
151
|
end
|
data/lib/balloon/http/client.rb
CHANGED
data/lib/balloon/processing.rb
CHANGED
@@ -18,7 +18,7 @@ module Balloon
|
|
18
18
|
total_size = handle_resize(image, ext, data)
|
19
19
|
data[:total_size] = processed_img.size.to_i + total_size.to_i
|
20
20
|
|
21
|
-
mime_type = processed_img.
|
21
|
+
mime_type = FileExtension.get_mime_type(processed_img.type)
|
22
22
|
extension = FileExtension.get_extension(mime_type)
|
23
23
|
filename = "#{image.basename}.#{extension}"
|
24
24
|
|
@@ -36,7 +36,7 @@ module Balloon
|
|
36
36
|
|
37
37
|
def handle_original(file, ext)
|
38
38
|
original_image = MiniMagick::Image.open(file.path)
|
39
|
-
convert = MiniMagick
|
39
|
+
convert = MiniMagick.convert
|
40
40
|
convert << file.path
|
41
41
|
|
42
42
|
auto_orient!(original_image, convert)
|
@@ -58,7 +58,7 @@ module Balloon
|
|
58
58
|
img = MiniMagick::Image.open(file.path)
|
59
59
|
raise ProcessError, "process error" unless img
|
60
60
|
|
61
|
-
convert = MiniMagick
|
61
|
+
convert = MiniMagick.convert
|
62
62
|
convert << file.path
|
63
63
|
|
64
64
|
auto_orient!(img, convert)
|
data/lib/balloon/uploader.rb
CHANGED
data/lib/balloon/version.rb
CHANGED
data/lib/balloon.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: balloon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yeeli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
229
|
+
rubygems_version: 3.5.3
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Ruby image upload libary
|