obf 0.6.30 → 0.6.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/obf/utils.rb +11 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d429c4dfe662ff1048c6a2e74a13c8640e3da35
|
4
|
+
data.tar.gz: 7d3bb396e6ce6317cc24a09e1df2c3adfee5e55e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc702de3b29b71c0ee57cb6fbb64404e33bf10e37454f094769bf3c84835f45c93e3206aa03abb2b83a74ab243faee3ec970a0a63d16aed9abf445d8677595f
|
7
|
+
data.tar.gz: 3b15fc57800c0d5603f0e2cd1fb821d1073e5c061bb91b98949b93ab6b6ad113a9b02a46189d2f9d65131c4d63e435cc43d1ad55671a79d8fe02f630a2bf5310
|
data/lib/obf/utils.rb
CHANGED
@@ -135,6 +135,7 @@ module OBF::Utils
|
|
135
135
|
end
|
136
136
|
type = MIME::Types[image['content_type']]
|
137
137
|
type = type && type[0]
|
138
|
+
extension = nil
|
138
139
|
if type.respond_to?(:preferred_extension)
|
139
140
|
extension = type && ("." + type.preferred_extension)
|
140
141
|
elsif type.respond_to?(:extensions)
|
@@ -152,11 +153,16 @@ module OBF::Utils
|
|
152
153
|
return nil
|
153
154
|
end
|
154
155
|
file.close
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
156
|
+
if extension && ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'].include?(image['content_type']) && image['width'] < 1000 && image['width'] == image['height']
|
157
|
+
`cp #{file.path} #{file.path}.#{extension}`
|
158
|
+
"#{file.path}.#{extension}"
|
159
|
+
else
|
160
|
+
# TODO: maybe convert to jpg instead of png?
|
161
|
+
# see https://github.com/prawnpdf/prawn/issues/324
|
162
|
+
# in that case, fill the image with a white background, perhaps?
|
163
|
+
`convert #{file.path} -density 1200 -resize 300x300 -background white -gravity center -extent 300x300 #{file.path}.png`
|
164
|
+
"#{file.path}.png"
|
165
|
+
end
|
160
166
|
end
|
161
167
|
|
162
168
|
def self.sound_raw(url)
|