[wp-trac] [WordPress Trac] #34810: wp_calculate_image_srcset(): Reduce accepted aspect ratio difference

WordPress Trac noreply at wordpress.org
Sat Nov 28 17:15:20 UTC 2015


#34810: wp_calculate_image_srcset(): Reduce accepted aspect ratio difference
----------------------------+------------------------
 Reporter:  jaspermdegroot  |       Owner:  joemcgill
     Type:  defect (bug)    |      Status:  accepted
 Priority:  normal          |   Milestone:  4.4
Component:  Media           |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------
Changes (by joemcgill):

 * keywords:   => has-patch
 * owner:   => joemcgill
 * status:  new => accepted
 * milestone:  Awaiting Review => 4.4


Comment:

 I agree that an aspect ratio difference of .01 is too permissive. We can
 probably be even more strict than .005, In
 [https://core.trac.wordpress.org/attachment/ticket/34810/34810.diff
 34810.diff], I've changed the allowed variance to .002, which should
 account for rounding variance and have fewer false positives.

 This is mainly and issue when we're comparing larger images to be included
 in a `srcset`. As the difference between the widths being compared
 increases, the probability that rounding will introduce false positives
 also grows. We could make the aspect ratio variance we allow relative to
 the difference between the widths we're comparing, but the extra
 calculation is probably unnecessary unless the difference between image
 widths is in the tens of thousands.

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


More information about the wp-trac mailing list