[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
Sun Dec 20 06:32:06 UTC 2015


#35128: Srcset may include a much-too-large image, apparently no way to set size in
context
--------------------------+------------------------------
 Reporter:  programmin    |       Owner:  joemcgill
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by programmin):

 Here's an easily testable case where it uses massively more bandwidth, not
 less, using srcset:

 Go and insert a big image on a page, but choose "medium" size. You'll see
 a medium-sized image in the editor.

 Now grab a resizer, and make it just a few pixels bigger. After saving you
 will see something like this in the page html:

 {{{
 <img class="alignnone wp-image-535 " src="http://localhost/wordpress/wp-
 content/uploads/2014/10/ffe2b73ac2dd5272-300x225.jpg" alt="" width="303"
 height="227" srcset="http://localhost/wordpress/wp-
 content/uploads/2014/10/ffe2b73ac2dd5272-300x225.jpg 300w,
 http://localhost/wordpress/wp-content/uploads/2014/10/ffe2b73ac2dd5272.jpg
 1024w" sizes="(max-width: 303px) 100vw, 303px">
 }}}


 The browser (Chromium 47 at least) decides that it will download the
 1024x768 image, not the more appropriate medium image, just because the
 chosen size is a few px more than the medium image. Maybe this is a
 browser bug more than a WP bug, but this will be affecting numerous blog
 viewers.

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


More information about the wp-trac mailing list