[wp-trac] [WordPress Trac] #62530: Inline SVG Images Cannot Be Sized

WordPress Trac noreply at wordpress.org
Fri Dec 12 19:52:01 UTC 2025


#62530: Inline SVG Images Cannot Be Sized
--------------------------+-------------------------
 Reporter:  timsinclair   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Editor        |     Version:  6.7.1
 Severity:  normal        |  Resolution:  worksforme
 Keywords:                |     Focuses:
--------------------------+-------------------------
Changes (by sabernhardt):

 * keywords:  needs-patch =>
 * resolution:   => worksforme
 * status:  new => closed
 * component:  Media => Editor
 * milestone:  Awaiting Review =>


Comment:

 I was able to reproduce the resizing problem in the editor with WordPress
 6.7.1, which gave an empty `style` attribute. Now, 6.9 technically can
 resize SVGs that are added as inline images. I'll close the ticket as
 'works for me' even though there are related issues to fix.

 1. When I clicked on the inline image in Chrome and Edge, the popover for
 width and `alt` settings did not open.
 [https://github.com/WordPress/gutenberg/issues/72949 GB72949] already
 reported that, and I was able to drag-select the image in those browsers.
 (I was able to open the settings just by clicking on the image in Firefox,
 however.)
 2. When the inline image is inserted into a rich text block, before
 resizing the image, the width value in the `style` attribute is `NaNpx`
 because the
 [https://github.com/WordPress/gutenberg/blob/c7dff504a2bc4f74de9a242f925e07cd852c5a7f/packages
 /format-library/src/image/index.js#L175-L178 format-library script] does
 not account for the possibility of an undefined `imgWidth`. I did not find
 an open issue about that in the
 [https://github.com/WordPress/gutenberg/issues Gutenberg repository], if
 someone would like to search again and/or submit a report there.
 3.
 [https://core.trac.wordpress.org/query?status=!closed&component=Media&summary=~svg
 Multiple tickets] report other problems with SVG, and at least two of
 those result from missing size information in the database (when the file
 is uploaded **without** using a plugin such as Safe SVG or SVG Support).
 The general ticket about adding SVG support in Core is #24251.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62530#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list