[wp-trac] [WordPress Trac] #34931: Adding a filter to modify ratio differs when generating img srcset

WordPress Trac noreply at wordpress.org
Wed Dec 9 15:35:45 UTC 2015


#34931: Adding a filter to modify ratio differs when generating img srcset
-----------------------------------------+------------------------------
 Reporter:  mbcreation                   |       Owner:  joemcgill
     Type:  enhancement                  |      Status:  reviewing
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Media                        |     Version:  4.4
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |     Focuses:
-----------------------------------------+------------------------------

Comment (by mbcreation):

 @joemcgill

 These are dump of $image and ratio from wp_calculate_image_srcset loop.
 Original is 3008*2000 so it's filtered out by max_srcset_image_width

 {{{#!php
 <?php
                         array(3) {
   ["file"]=>
   string(20) "desserts-150x150.jpg"
   ["width"]=>
   string(3) "150"
   ["height"]=>
   string(3) "150"
 }
 float(0.33333333333333)
 array(3) {
   ["file"]=>
   string(20) "desserts-300x199.jpg"
   ["width"]=>
   string(3) "300"
   ["height"]=>
   string(3) "199"
 }
 float(0.0033333333333333)
 array(3) {
   ["file"]=>
   string(21) "desserts-1024x680.jpg"
   ["width"]=>
   string(4) "1024"
   ["height"]=>
   string(3) "680"
 }
 float(0.0026041666666666)
 array(3) {
   ["file"]=>
   string(20) "desserts-595x231.jpg"
   ["width"]=>
   string(3) "595"
   ["height"]=>
   string(3) "231"
 }
 float(0.27843137254902)
 array(3) {
   ["file"]=>
   string(19) "desserts-123x82.jpg"
   ["width"]=>
   string(3) "123"
   ["height"]=>
   string(2) "82"
 }
 float(0)
 }}}

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


More information about the wp-trac mailing list