Postponed
Project:
Album Photos
Version:
6.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 May 2021 at 15:50 UTC
Updated:
13 May 2021 at 15:39 UTC
Jump to comment: Most recent
EXIF values lost if the image is larger than the max resolution limit for field_image.
Similar issue: #2886469: file_validate_image_resolution removes exif data
Comments
Comment #2
WebbehComment #3
kingto commentedOnly happens on the entity form, but works great on the classic form, where EXIF values are always recorded even if the image is resized to the max resolution.
I found how the patch works in similar issue #2886469 is to extract and record the EXIF values BEFORE the resizing.
Just curious how the classic form could do this.
Anyway, this should be an issue that belongs to module EXIF...but also vital for us. Tragically I found no people there follow the issue report.
If it is possible to get it fixed, I think I will dream of that beeping for a long time haha!
Comment #4
WebbehConnecting similar issue.
Comment #5
nathaniel commentedThe problem is Drupal resizes images when they are uploaded during file validation before the entity is saved and this strips the exif data.
The exif module saves the exif data when the entity is saved in hook_ENTITY_TYPE_presave().
To get around that in the classic form the entity is created before the images are resized.
One possible solution might be to cache the file exif data when the file is uploaded during validation, then use the cache when the entity is saved. This would likely require some code changes in the Exif module.
One possible workaround is to remove the field settings for “Maximum image resolution”, set the classic form setting for “Maximum image resolution” and add a custom hook with something like this to resize the image after the entity is saved. Similar to what the classic form does. This will only work if it happens after the photos / exif module hooks.
Notes:
Comment #6
kingto commentedMuch appreciated!!! That's what I've been dreaming of for weeks.
For my bad luck, a PHP error happens again. I think this is the very last issue.
Probably something wrong with the Entity name, even if I added
It still keeps telling this when I submit a new photo:
With gratitude!
Comment #7
nathaniel commentedOh! Try
use Drupal\Core\Entity\EntityInterface;Comment #8
kingto commentedAmazing, it works!!!
You are the best, thank you sooooooo much!
Comment #9
nathaniel commentedGlad that works! Postponed for now. Maybe we can work with exif maintainers to come up with a better solution.