[wp-trac] [WordPress Trac] #63302: SVG images can't be uploaded anymore due to a resizing issue
WordPress Trac
noreply at wordpress.org
Sat Apr 19 20:59:10 UTC 2025
#63302: SVG images can't be uploaded anymore due to a resizing issue
-------------------------------------------------+-------------------------
Reporter: audrasjb | Owner:
| adamsilverstein
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.8.1
Component: Editor | Version: 6.8
Severity: normal | Resolution:
Keywords: has-screenshots has-patch dev- | Focuses:
feedback needs-testing has-testing-info |
needs-unit-tests |
-------------------------------------------------+-------------------------
Comment (by pbiron):
looks like `WP_Image_Editor_Imagick::supports_mime_type()` results in a
call to `wp_get_default_extension_for_mime_type()`, and asks if Imagick
supports the returned extension.
`wp_get_default_extension_for_mime_type()` has a fixed assoc array that
maps extensions to mime types. Of course, `'svg' => 'image/svg+xml'` is
not in that array. However, the `mime_type` filter is applied to that
assoc array.
Unfortunately, `Safe SVG` does **not** hook into that filter. And so
`wp_get_default_extension_for_mime_type()` can't find the right file
extension to query Imagick for.
Whether `Safe SVG` wants to add a callback for the `mime_type` filter or
not is up to them, but I don't think it really matters for 2 reasons
1. SVGs don't need sub-sizes generated
2. the upload should be allowed by the REST API even if Imagick isn't
installed (i.e., GD is used for editing images)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63302#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list