[wp-trac] [WordPress Trac] #35291: filters for responsive image srcset and sizes attributes

WordPress Trac noreply at wordpress.org
Sun Jan 3 01:46:24 UTC 2016


#35291: filters for responsive image srcset and sizes attributes
-------------------------+----------------------------------------
 Reporter:  Hube2        |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:  4.4
 Severity:  normal       |   Keywords:  responive image alternates
  Focuses:               |
-------------------------+----------------------------------------
 I think that hooks need to be added to the new responsive image features
 that allow the filtering of the srcset and the sizes attributes, which as
 far as I can see there isn't any way to modify what WP creates at any step
 of the operation.

 Why does this need to be added. I have clients that want to be able to
 specify alternate images. Meaning that for some screen sizes they want to
 use an image that has been modified and cropped to a different ratio. This
 allows them to have a short wide image on large screens and a tall narrow
 image on narrow screens.

 Lets look at the facts. If you take an image that is 1200x300 and reduce
 that image to 300x75, or worse 150x37, that image is going to be pretty
 useless as far as conveying any information is concerned. At that point
 the image may as well not be there.

 Selecting alternate images that are cropped at different ratios allows the
 client to add an image that is taller and narrow that conveys the same
 information and can actually be seen on a narrow screen.

 I don't expect WP to make it possible for users to actually do this
 alternate image selection. This is something that I can and have added to
 WP it the past.

 What I would like is a way to filter the size and srcset attributes so
 that I can make the needed changes to accomplish what the client wants.

 This is not something that I have encountered only once or once in a
 while, this is requirement that I run into consistently.

 As it stands, the only way that I can meet this requirement since WP4.4 is
 to completely disable all of the filters used by WP to accomplish it and
 substitute my own, which I would prefer not to do.

 Thanks for considering it.

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


More information about the wp-trac mailing list