- Issue created by @kaszarobert
- πΈπ°Slovakia kaszarobert
I attach a possible patch with a workaround: where we get the current image width and height, we also check the EXIF Orientation metadata, so if we need to rotate the original image, then we also get the proper width and height.
When we did the patch, our solution required to work with both GD and ImageMagick image processing libraries + with s3fs module and Amazon S3/Google Cloud Storage file systems, so that's why in the patch we're introducing a dependency to the file_mdm module for checking the needed metadata from image files (which is also a dependency for image_effects) as there's no other built-in way in PHP that works with all of these integrations.
There's also the
src/Plugin/Field/FieldWidget/ImageCropWidget.php getFileImageVariables()
function that I did not modify because it was never called by any module. Or do we need to apply this proper width-height checking there, too? - πΈπ°Slovakia kaszarobert
It turns out when using s3fs + using the "Automatically correct orientation" effect means that on an uncached page it will download all the image files from s3fs storage to get its Orientation EXIF metadata during the page load which adds several seconds to TTFB. I guess using the "Automatically correct orientation" effect can't be a scalable solution, we should fix the original image's Orientation instead of doing all these hoops during page load and image style derivative generating manually.