obf 0.6.21 → 0.6.22
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 +12 -3
- 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: 71e30f866a01995e08ca6c519b7a80799ef40d02
|
4
|
+
data.tar.gz: 6625177ac355eec234625152fac7abbacaff4515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dc5b6b126eac50c4dc1051760b00519b7868a68b04dc165ad8eb1a3f29e02a326165de638891c1ae2049d5b467f389e81d6fc1b56c4bdbdd7beb67c79aa53fb
|
7
|
+
data.tar.gz: 7260b87077c93b60ecc73ecf918dbab60ca09ea385c8df55ed6b3ff41e6228a2149fca2ae474ac2f492773247ce1d9cfb4ffdb71632bc6780c6bcb52bac306f8
|
data/lib/obf/utils.rb
CHANGED
@@ -26,7 +26,10 @@ module OBF::Utils
|
|
26
26
|
'extension' => extension
|
27
27
|
}
|
28
28
|
if content_type && content_type.match(/^image/)
|
29
|
-
|
29
|
+
attrs = image_attrs(data)
|
30
|
+
res['content_type'] ||= attrs['content_type']
|
31
|
+
res['width'] ||= attrs['width']
|
32
|
+
res['height'] ||= attrs['height']
|
30
33
|
end
|
31
34
|
res
|
32
35
|
end
|
@@ -107,7 +110,10 @@ module OBF::Utils
|
|
107
110
|
'data' => File.read(url),
|
108
111
|
'content_type' => types[0] && types[0].to_s
|
109
112
|
}
|
110
|
-
|
113
|
+
attrs = image_attrs(url)
|
114
|
+
image['content_type'] ||= attrs['content_type']
|
115
|
+
image['width'] ||= attrs['width']
|
116
|
+
image['height'] ||= attrs['height']
|
111
117
|
end
|
112
118
|
return nil unless image
|
113
119
|
str = "data:" + image['content_type']
|
@@ -335,7 +341,10 @@ module OBF::Utils
|
|
335
341
|
file.binmode
|
336
342
|
file.write raw
|
337
343
|
file.close
|
338
|
-
|
344
|
+
more_attrs = OBF::Utils.image_attrs(file.path)
|
345
|
+
attrs['content_type'] ||= more_attrs['content_type']
|
346
|
+
attrs['width'] ||= more_attrs['width']
|
347
|
+
attrs['height'] ||= more_attrs['height']
|
339
348
|
end
|
340
349
|
attrs
|
341
350
|
end
|