Opened 3 years ago
Last modified 5 weeks ago
#58611 assigned defect (bug)
wp_get_missing_image_subsizes can return incorrect subsizes for a rotated image
| Reported by: | ianmjones | Owned by: | antpb |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Media | Version: | 6.2.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
During the upload of a rotated image to the Media Library, the wp_get_missing_image_subsizes() function often returns missing subsizes for the non-rotated original image that will never be generated for the rotated image.
This means for example, if a plugin is filtering wp_update_attachment_metadata and waiting for all thumbnails to have been generated before performing some action, it may be told that there are missing thumbnails for a rotated image, that will not be generated. Therefore it will not be able to perform that action as not all the thumbnails are deemed to be available.
Change History (17)
This ticket was mentioned in PR #4681 on WordPress/wordpress-develop by @ianmjones.
3 years ago
#1
- Keywords has-patch added; needs-patch removed
This ticket was mentioned in Slack in #core-media by ianmjones. View the logs.
3 years ago
This ticket was mentioned in Slack in #core-media by ianmjones. View the logs.
3 years ago
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
3 years ago
This ticket was mentioned in Slack in #core-media by ianmjones. View the logs.
3 years ago
#8
@
3 years ago
- Keywords needs-patch added; has-patch removed
- Milestone 6.3 → 6.4
Moving this to 6.4 as it needs a patch.
This ticket was mentioned in Slack in #core by marybaum. View the logs.
3 years ago
#10
@
3 years ago
Asking @antpb if maybe the EXIF data import should not include the rotation data.
Then we can consider an acceptable patch.
#11
@
3 years ago
@antpb just checking in on this ticket. Could you review #comment:10?
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
3 years ago
#13
@
3 years ago
- Milestone 6.4 → 6.5
with this needing a rework on the solution to account for the suggestion @ianmjones made we should move to 6.5
From @ianmjones : "To properly determine whether the original image can be used to generate missing thumbnail sizes, we probably need to grab its width vs. height ratio and compare with the full size image's ration. If they're the same, then yay, we can use the original and maybe pick up a couple extra sizes, but otherwise, stick with the full size image."
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
#15
@
3 years ago
- Milestone 6.5 → Future Release
As per today's bug scrub, we decided to move this ticket to Future Release to give it more time to get a patch.
This ticket was mentioned in PR #12400 on WordPress/wordpress-develop by @shreya0shrivastava.
5 weeks ago
#16
- Keywords has-patch added; needs-patch removed
Prevent wp_get_missing_image_subsizes() from reporting incorrect missing subsizes for rotated images by using the processed image dimensions when the original and processed image aspect ratios differ, while preserving the existing behavior for non-rotated images.
Trac ticket: https://core.trac.wordpress.org/ticket/58611
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Opus 4.7
Used for: Initial code skeleton; final implementation and tests were reviewed and edited by me.
This ticket was mentioned in PR #12400 on WordPress/wordpress-develop by @shreya0shrivastava.
5 weeks ago
#17
Prevent wp_get_missing_image_subsizes() from reporting incorrect missing subsizes for rotated images by using the processed image dimensions when the original and processed image aspect ratios differ, while preserving the existing behavior for non-rotated images.
Trac ticket: https://core.trac.wordpress.org/ticket/58611
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Opus 4.7
Used for: Initial code skeleton; final implementation and tests were reviewed and edited by me.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
During the upload of a rotated image, the
wp_get_missing_image_subsizes()function currently incorrectly uses the dimensions of the non-rotated original image to determine which subsizes should exist.This changeset adds a condition that the original image should only be used for setting the image dimensions if the orientation of the Media Library item has not been changed.