[wp-trac] [WordPress Trac] #50944: wp_calculate_image_srcset can unintentionally include unscaled original image

WordPress Trac noreply at wordpress.org
Wed Aug 12 14:08:34 UTC 2020


#50944: wp_calculate_image_srcset can unintentionally include unscaled original
image
--------------------------+-----------------------------
 Reporter:  fredrikll     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In `wp-includes/media.php`, `wp_calculate_image_srcset` seems to add the
 original image to the srcset string if the width is smaller than
 `$max_srcset_image_width` and if the image isn't a GIF. This isn't
 desirable since the original image is uncompressed and I don't even think
 it's intentional.

 This behavior seems to have been introduced in this patch:
 https://core.trac.wordpress.org/changeset/35561. From what I can tell, the
 if statement should read like this:

 {{{#!php
 if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' ===
 $image_sizes['thumbnail']['mime-type'] ) {
 }}}

 The current code will include the original image whenever the thumbnail IS
 NOT a GIF. This seems to be opposite to the desired behavior?

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


More information about the wp-trac mailing list