#50543 closed defect (bug) (fixed)
Media: wp_image_src_get_dimensions() may throw warning or return wrong values
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Media | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
Happens when the attachment ID (typically hard-coded in the post content) used to get the image meta has changed for some reason, for example when the site was exported and imported.
Attachments (3)
Change History (13)
#2
@
5 years ago
In 50543.1.diff: also account for edge case when an uploaded image is smaller than the smallest sub-size ($image_meta['sizes']
is empty). We still need the width and height if the file and path matches.
#4
in reply to:
↑ 3
@
5 years ago
Replying to Otto42:
Thanks for testing! :)
Seems the same functionality (check if the attachment ID matches the image) will be needed at least at one more place, in the edit image end point. Will update the patch and commit.
#5
@
5 years ago
- Keywords needs-unit-tests removed
In 50543:
- Introduce
wp_image_file_matches_image_meta()
andwp_image_file_matches_image_meta
filter as this will be needed in few places. - Add few tests for the new function.
#6
@
5 years ago
- Owner set to azaozz
- Resolution set to fixed
- Status changed from new to closed
In 48329:
Note: See
TracTickets for help on using
tickets.
In 50543.diff:
$image_meta
is actually the meta data for an image.width
andheight
from$image_meta
.Would also be great to add a unit test or two, perhaps after beta is out :)