[wp-trac] [WordPress Trac] #46885: Improvements/Issues with srcsets, additions to wp_calculate_image_srcset

WordPress Trac noreply at wordpress.org
Fri Apr 12 17:51:05 UTC 2019

#46885: Improvements/Issues with srcsets, additions to wp_calculate_image_srcset
 Reporter:  pinktank     |       Owner:  joemcgill
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Media        |     Version:  5.1
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
Changes (by joemcgill):

 * owner:  (none) => joemcgill
 * status:  new => assigned


 Replying to [comment:2 pinktank]:
 > Hi @joemcgill,
 > Thanks for responding so quickly.

 You're very welcome :)

 > **1.** I did see the filter but my php and understanding of core is not
 up to snuff to write that loop (I parsed the output string with the comma
 as a needle instead as a temporary hack o_o).

 > Alternatively somebody could add a filter snippet to the documentation.

 I think that adding an example for this to the documentation website is a
 great idea.

 > **2.** As I mentioned in the paranthesis, I know why the src comes
 first, I didn't understand why the second smallest came before the the
 smallest in 360,180,720 rather than 180,360,720.

 Apologies for missing your parenthetical comment. I'd say it is definitely
 unexpected that you would be seeing the rest of the sources listed out of
 order, but as I mentioned, it shouldn't make any difference to browsers,
 so is not something we would probably prioritize fixing at the moment.

 > **3.** I had mentioned this for the off cases where people use filters
 with certain sizing options to change the image and for those who want to
 load 2^N versions only to avoid pixel 1px shift due to rounding issues.
 The wp_image_matches_ratio is –thankfully– forgiving of 1px but some
 applications could use exact doubles. Again though this was the most edge-
 case of my recommendations, not a pressing issue.

 We already have #32437 that covers the potential duplication issue, if I'm
 understanding correctly. Otherwise, it's still a bit unclear to me what
 use cases you are trying to solve for with the third item.

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

More information about the wp-trac mailing list