imagery 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/imagery.gemspec +1 -1
- data/lib/imagery.rb +9 -3
- metadata +1 -1
data/imagery.gemspec
CHANGED
data/lib/imagery.rb
CHANGED
@@ -2,7 +2,7 @@ require "fileutils"
|
|
2
2
|
require "tempfile"
|
3
3
|
|
4
4
|
class Imagery
|
5
|
-
VERSION = "0.2.
|
5
|
+
VERSION = "0.2.1"
|
6
6
|
|
7
7
|
autoload :S3, "imagery/s3"
|
8
8
|
autoload :Faking, "imagery/faking"
|
@@ -146,8 +146,14 @@ class Imagery
|
|
146
146
|
|
147
147
|
def self.identify(io)
|
148
148
|
file = Tempfile.new("imagery")
|
149
|
+
|
150
|
+
# Something poorly documented, but vastly important: we need to
|
151
|
+
# make sure the file is in binary mode.
|
152
|
+
file.binmode
|
153
|
+
|
154
|
+
# Now we can safely write the file knowing that we're operating in
|
155
|
+
# binary mode.
|
149
156
|
file.write(io.read)
|
150
|
-
file.close
|
151
157
|
|
152
158
|
`gm identify #{io.path} 2> /dev/null`
|
153
159
|
|
@@ -157,7 +163,7 @@ class Imagery
|
|
157
163
|
io.rewind
|
158
164
|
|
159
165
|
# Tempfile quickly runs out of names, so best to avoid that.
|
160
|
-
file.
|
166
|
+
file.close!
|
161
167
|
end
|
162
168
|
|
163
169
|
# Return the cleaned dimension representation minus the
|