[wp-trac] [WordPress Trac] #35128: Srcset may include a much-too-large image, apparently no way to set size in context

WordPress Trac noreply at wordpress.org
Thu Dec 17 01:33:52 UTC 2015


#35128: Srcset may include a much-too-large image, apparently no way to set size in
context
--------------------------+-----------------------------
 Reporter:  programmin    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 While srcset is great for showing the relevant sized image, it may often
 grab an image that is actually much too large for the space it shows in.

 For example, WP outputs this html for a certain image:


 {{{
 <img class=" wp-image-3279 aligncenter"
 src="http://www.cbcblountville.com/hp_wordpress/wp-content/uploads/2015/11
 /Worship-300x225.png" alt="Worship" width="515" height="386"
 srcset="http://www.cbcblountville.com/hp_wordpress/wp-
 content/uploads/2015/11/Worship-300x225.png 300w,
 http://www.cbcblountville.com/hp_wordpress/wp-content/uploads/2015/11
 /Worship-1024x768.png 1024w, http://www.cbcblountville.com/hp_wordpress
 /wp-content/uploads/2015/11/Worship.png 1502w" sizes="(max-width: 515px)
 100vw, 515px">
 }}}

 however, due to a special enclosing div, this particular one is displayed
 within 323x243. The network inspector shows it's actually grabbing the 768
 image.

 Can we have a way to fix this, at least give themes a way to say for
 example, images that are within the post-content .span4 element will be
 max-width of 323?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35128>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list