-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUGFIX: Use autorotate filter to apply resize adjustments properly to images with exif-orientations #3147
Conversation
@daniellienert Not sure wether this is the right way to handle images with exif-orientation but for me it worked. Another question would be wether this is a bugfix or a feature and which branch to target. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and it works. But why you want to put this only to master?
@jonnitto that is why i asked what to target and wether this is a bug or a feature |
From an editorial perspective, this is a bugfix |
Added the autorotation also to the dimension calculation to ensure that correct sizes are calculated. |
0d18af9
to
74ec6f4
Compare
…erly to images that used exif-orientations The autorotate is applied before calculating the dimensions to work with correct size values.
74ec6f4
to
c4a293d
Compare
FYI: I rebased this to 4.3 as bugfix |
@@ -456,6 +456,9 @@ protected function resize(ImagineImageInterface $image, string $mode = ImageInte | |||
throw new \InvalidArgumentException('Invalid mode specified', 1574686891); | |||
} | |||
|
|||
$autorotateFilter = new \Imagine\Filter\Basic\Autorotate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am currently trying to untangle the complete image processing workflow ... Wouldn't it make sense to put it into a separate rotate adjustment? Is there no scenario where you don't want to have it rotated or where it is breaking? Should the adjustment be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daniellienert The autorotate filter does nothing if no exif orientation is set and in other cases it applies the transformation to the image so following filters do not have to deal with it. (https://github.com/avalanche123/Imagine/blob/develop/src/Filter/Basic/Autorotate.php) as far as i see this filter is meant to be applied to all images.
The only way that could cause problems i can imagine is when some code would transfer the original exif tags to the generated image-variant. Not sure wether such things exist and i would assume that the result would be broken in that case today aswell because the calculations are performed on flipped dimensions.
But i am far from sure that this is the correct way to apply this filter. The only thing i know is that this filter has to be applied before calculating dimensions and crops to support exif-orientations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found this in the notes of the Autorotate filter Your attention please: This filter requires the use of the ExifMetadataReader to work.
and in ExifMetadataReader it states Using the exif metadata reader adds a significant overhead to image processing.
Still think that it is still more important to properly read images and doubt that the exif parsing can be that significant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yap. We have quite some projects where editors complain about this bug
Close and reopen to trigger travis |
@daniellienert Is it ok for you if we merge this one? |
👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A post-merge "yay, and it looks good" from my side…
BUGFIX: Use autorotate filter to apply resize adjustments properly to images with exif-orientations
The autorotate is applied before calculating the resize dimensions to work with correct size values.
How to test:
Resolves: #3148