[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:24:26 UTC 2019


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

Comment (by pinktank):

 Hi @joemcgill,
 Thanks for responding so quickly.
 **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).

 I suspected that others would find helpful adding a $src_first parameter
 to the the function. It would just plug into line 1175 as if($is_src &&
 $src_first). You could plug it in earlier to skip a conditional but this
 seemed more semantically correct.

 Alternatively somebody could add a filter snippet to the documentation.

 **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.

 **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.

 cheers

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


More information about the wp-trac mailing list