fastimage 1.2.4 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/fastimage.rb +4 -3
- data/test/fixtures/test2.jpg +0 -0
- data/test/test.rb +3 -2
- metadata +4 -3
data/VERSION.yml
CHANGED
data/lib/fastimage.rb
CHANGED
@@ -198,6 +198,7 @@ class FastImage
|
|
198
198
|
|
199
199
|
def parse_size
|
200
200
|
@type = parse_type unless @type
|
201
|
+
@strpos = 0
|
201
202
|
send("parse_size_for_#{@type}")
|
202
203
|
end
|
203
204
|
|
@@ -237,11 +238,11 @@ class FastImage
|
|
237
238
|
end
|
238
239
|
|
239
240
|
def parse_size_for_gif
|
240
|
-
get_chars(
|
241
|
+
get_chars(11)[6..10].unpack('SS')
|
241
242
|
end
|
242
243
|
|
243
244
|
def parse_size_for_png
|
244
|
-
get_chars(
|
245
|
+
get_chars(25)[16..24].unpack('NN')
|
245
246
|
end
|
246
247
|
|
247
248
|
def parse_size_for_jpeg
|
@@ -275,7 +276,7 @@ class FastImage
|
|
275
276
|
end
|
276
277
|
|
277
278
|
def parse_size_for_bmp
|
278
|
-
d = get_chars(
|
279
|
+
d = get_chars(29)[14..28]
|
279
280
|
d.unpack("C")[0] == 40 ? d[4..-1].unpack('LL') : d[4..8].unpack('SS')
|
280
281
|
end
|
281
282
|
end
|
Binary file
|
data/test/test.rb
CHANGED
@@ -14,7 +14,8 @@ GoodFixtures = {
|
|
14
14
|
"test.bmp"=>[:bmp, [40, 27]],
|
15
15
|
"test.gif"=>[:gif, [17, 32]],
|
16
16
|
"test.jpg"=>[:jpeg, [882, 470]],
|
17
|
-
"test.png"=>[:png, [30, 20]]
|
17
|
+
"test.png"=>[:png, [30, 20]],
|
18
|
+
"test2.jpg"=>[:jpeg, [250, 188]]
|
18
19
|
}
|
19
20
|
|
20
21
|
BadFixtures = [
|
@@ -45,7 +46,7 @@ class FastImageTest < Test::Unit::TestCase
|
|
45
46
|
assert_equal info[1], FastImage.size(TestUrl + fn, :raise_on_failure=>true)
|
46
47
|
end
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def test_should_return_nil_on_fetch_failure
|
50
51
|
assert_nil FastImage.size(TestUrl + "does_not_exist")
|
51
52
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 1.2.
|
8
|
+
- 6
|
9
|
+
version: 1.2.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Stephen Sykes
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-08 00:00:00 +03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- test/fixtures/test.ico
|
40
40
|
- test/fixtures/test.jpg
|
41
41
|
- test/fixtures/test.png
|
42
|
+
- test/fixtures/test2.jpg
|
42
43
|
- test/test.rb
|
43
44
|
has_rdoc: true
|
44
45
|
homepage: http://github.com/sdsykes/fastimage
|