posts: fix detection of exif_rotation tag.

`IFD0:Orientation` is the orientation of the main image.
`IFD1:Orientation` is the orientation of the embedded thumbnail, if it
has one. Using `IFD1:Orientation` was incorrect here because some images
have a non-rotated main image but a rotated thumbnail. Post #1023563 is
an example.
This commit is contained in:
evazion
2021-09-22 11:17:28 -05:00
parent b378785582
commit 6740ef17ab

View File

@@ -49,8 +49,7 @@ class MediaAsset < ApplicationRecord
# https://exiftool.org/TagNames/EXIF.html
def is_rotated?
metadata["IFD0:Orientation"].in?(["Rotate 90 CW", "Rotate 270 CW", "Rotate 180"]) ||
metadata["IFD1:Orientation"].in?(["Rotate 90 CW", "Rotate 270 CW", "Rotate 180"])
metadata["IFD0:Orientation"].in?(["Rotate 90 CW", "Rotate 270 CW", "Rotate 180"])
end
# Some animations technically have a finite loop count, but loop for hundreds