Opened 6 weeks ago
Last modified 5 weeks ago
#62312 new defect (bug)
wp_image_src_get_dimensions() - Warning for SVG with postmeta height and width empty
Reported by: | apermo | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
As @donbowman pointed out originally in https://core.trac.wordpress.org/ticket/57813#comment:2 wp_image_src_get_dimensions()
will throw a warning and have potentially broken results when used with an SVG.
After a short conversation with @soean, he followed my suggestion to split this topic up into an individual ticket, since this one is frontend related, the other is not.
I will prepare a PR on github, following @donbowman's initial findings.
Change History (5)
This ticket was mentioned in PR #7663 on WordPress/wordpress-develop by @apermo.
6 weeks ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core-test by oglekler. View the logs.
5 weeks ago
#3
@
5 weeks ago
@apermo to move forward, we need testing instructions.
For example, "upload an SVG without dimensions" and report how it looks. We need clear step-by-step instructions on how to reproduce the bug and steps to test the patch.
Thank you.
#4
@
5 weeks ago
@joesimpsonjr I haven't found this bug myself. As mentioned this is by @donbowman see https://core.trac.wordpress.org/ticket/57813#comment:2
So I can't provide a step by step guide sadly.
As originally pointed out by @donbowman,
wp_image_src_get_dimensions()
will not work properly for SVG, since they do not have sizes added to post meta. This is his original patch taken from https://core.trac.wordpress.org/ticket/57813#comment:2, just fixed the checks.Optionally we could consider to check the mimetype here. Any thoughts on that?
Trac ticket: https://core.trac.wordpress.org/ticket/62312#ticket