[wp-trac] [WordPress Trac] #36154: wp_calculate_image_srcset() filters out square resized feature image

WordPress Trac noreply at wordpress.org
Mon Mar 7 13:08:12 UTC 2016


#36154: wp_calculate_image_srcset() filters out square resized feature image
--------------------------+------------------------------
 Reporter:  solo14000     |       Owner:  joemcgill
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.4.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by joemcgill):

 * owner:   => joemcgill
 * status:  new => reviewing


Comment:

 Hi @solo14000,

 The design of `wp_calculate_image_srcset()` is to only include the images
 that match the aspect ratio of the image included in the `src` attribute.
 So you would only see the square sizes in your `srcset` if you the
 original is also a square image. You can test this one of two ways:

 * Upload a square original image and see if the `srcset` attributes
 include your custom square crops.
 * Upload any image and insert a square thumbnail into a post or do
 something like `wp_get_attachment_image_srcset( $id, 'thumbnail' );` in
 your template.

 In those cases, you should be seeing your custom square sizes but not any
 custom hard cropped rectangles.

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


More information about the wp-trac mailing list