#50543 closed defect (bug) (fixed)
Media: wp_image_src_get_dimensions() may throw warning or return wrong values
| Reported by: | azaozz | Owned by: | azaozz |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.5 |
| Component: | Media | Version: | 5.5 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: | Focuses: |
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
@
6 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
@
6 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
@
6 years ago
- Keywords needs-unit-tests removed
In 50543:
- Introduce
wp_image_file_matches_image_meta()andwp_image_file_matches_image_metafilter as this will be needed in few places. - Add few tests for the new function.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 50543.diff:
$image_metais actually the meta data for an image.widthandheightfrom$image_meta.Would also be great to add a unit test or two, perhaps after beta is out :)