From 6740ef17abcb4c04e22a69fb4c1bf64b7e88d254 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 22 Sep 2021 11:17:28 -0500 Subject: [PATCH] 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. --- app/models/media_asset.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/media_asset.rb b/app/models/media_asset.rb index b9e9c7ca2..eff8737f0 100644 --- a/app/models/media_asset.rb +++ b/app/models/media_asset.rb @@ -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