#54531 closed defect (bug) (invalid)
Automatic image rotation using exif orientation incorrectly rotating images
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.8.2 |
| Component: | Media | Keywords: | |
| Focuses: | administration | Cc: |
Description
When uploading rotated images that contain EXIF orientation data wordpress rotates them even though they're already rotated. I worked out that you can prevent this using the following code but it doesn't affect the thumbnail images, and they're still rotated.
add_filter('wp_image_maybe_exif_rotate', '__return_false');
I tried updating the metadata, but it didn't work to prevent the rotation of the thumbnail images.
function prevent_thumbnail_rotation($metadata, $attachment_id) {
$metadata['image_meta']['orientation'] = '';
return $metadata;
}
add_filter('wp_update_attachment_metadata', 'prevent_thumbnail_rotation', 10, 2);
The images are all rotated correctly before upload.
After upload many have '-rotated' appending to the file name, if the above code isn't used. This I want to avoid, as the images are to be attached via csv import and each image filename will need to be manually edited if it was rotated. The import fails if the image is rotated, even though the actual file exists, it's probably not part of the attachment post.
Change History (3)
#3
@
4 years ago
It was intentional to close the ticket. I'm not sure exactly what happened, but I was having a problem with this for a while. For some reason it worked when I removed all the code, and WordPress didn't rotate them if they were already rotated. I decided that there wasn't a bug, so I closed the ticket.
@arthurdaly just wanted to reach out and confirm that closing this ticket was intentional.
If it was intentional, I assume you discovered how to fix your issue. Please share a brief breakdown of the solution for others that come across this ticket in the future.