[wp-trac] [WordPress Trac] #62312: wp_image_src_get_dimensions() - Warning for SVG with postmeta height and width empty

WordPress Trac noreply at wordpress.org
Tue Feb 24 00:24:43 UTC 2026


#62312: wp_image_src_get_dimensions() - Warning for SVG with postmeta height and
width empty
--------------------------+------------------------------
 Reporter:  apermo        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  5.5
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by donbowman):

 an svg *might* have width/height embedded in it. It might not. It doesn't
 change its resolution (which is infinite), but does set a default visual
 size.

 when I set the size in wordpress i expect it to work for any image,
 regardless of raster versus vector.

 so i were to do a basic group with an image as float-right in it, and the
 image width is set to e.g. 350px, it would work out. something like below.

 so if i set 'auto', i guess it would use what's embedded in the svg, w/
 some sane fallback. If i set some resolution, either w or h, it would
 override that in the svg.

 the patches I did were to avoid issues when uploading an svg w/o width or
 height encoded inside it.


 {{{
 <!-- wp:group {"layout":{"type":"default"}} -->
 <div class="wp-block-group"><!-- wp:group
 {"layout":{"type":"constrained","contentSize":"1190px"}} -->
 <div class="wp-block-group"><!-- wp:image
 {"id":8011832,"width":"320px","sizeSlug":"full","linkDestination":"none","align":"right"}
 -->
 <figure class="wp-block-image alignright size-full is-resized"><img
 src="https://www.agilicus.com/www/2a321b0b-cloud.svg" alt="" class="wp-
 image-8011832" style="width:320px"/></figure>
 <!-- /wp:image -->

 <!-- wp:paragraph -->
 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
 tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
 veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
 commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
 velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
 cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
 est laborum.</p>
 <!-- /wp:paragraph -->

 <!-- wp:paragraph -->
 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
 tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
 veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
 commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
 velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
 cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
 est laborum.</p>
 <!-- /wp:paragraph --></div>
 <!-- /wp:group --></div>
 <!-- /wp:group -->
 }}}

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


More information about the wp-trac mailing list