Only pay attention to first APP1 segment for orientation. Fixes #102

This commit is contained in:
Stephen Sykes 2018-05-01 14:39:10 +03:00
parent c7cad12fa0
commit 15f3e95b25
3 changed files with 4 additions and 2 deletions

View File

@ -531,7 +531,8 @@ class FastImage
io = StringIO.new(data) io = StringIO.new(data)
if io.read(4) == "Exif" if io.read(4) == "Exif"
io.read(2) io.read(2)
exif = Exif.new(IOStream.new(io)) rescue nil new_exif = Exif.new(IOStream.new(io)) rescue nil
exif ||= new_exif # only use the first APP1 segment
end end
:started :started
when 0xe0..0xef when 0xe0..0xef

BIN
test/fixtures/orient_6.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 KiB

View File

@ -34,7 +34,8 @@ GoodFixtures = {
"test_partial_viewport.svg" => [:svg, [860, 400]], "test_partial_viewport.svg" => [:svg, [860, 400]],
"test2.svg" => [:svg, [366, 271]], "test2.svg" => [:svg, [366, 271]],
"test3.svg" => [:svg, [255, 48]], "test3.svg" => [:svg, [255, 48]],
"test4.svg" => [:svg, [271, 271]] "test4.svg" => [:svg, [271, 271]],
"orient_6.jpg"=>[:jpeg, [1250,2500]]
} }
BadFixtures = [ BadFixtures = [