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

WordPress Trac noreply at wordpress.org
Mon Mar 7 22:03:19 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:

Comment (by solo14000):

 Hi @joemcgill,

 I did not pay attention that wp_caculate_image_srcset() is handling image
 resized set having only the same aspect ratio as the original. May be the
 WP documentation is a quite too short or I do not know much about the
 srcset attribute specification.

 My use case is in fact the following :
 * unregister all built-in WP image sizes
 * upload an event (custom post type) flyer (size varies from event to
 event. There is no size constraint for my customer)

 * resize this flyer to match the fullwidth of 3 target devices. These
 images are displayed in the event detail page.

  add_image_size('full_small', 480, 480, false);
  add_image_size('full_medium', 600, 600, false);
  add_image_size('full_large', 992, 992, false);

 * resize this flyer in square with cropping to match Google avatar list
 specifications in their material design.

  add_image_size('avatar_small', 40, 40, true);
  add_image_size('avatar_medium', 56, 56, true);
  add_image_size('avatar_large', 64, 64, true);

 I made a workaround to the wp_caculate_image_srcset() built-in behavior.

 Thanks anyway.

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

More information about the wp-trac mailing list