[wp-trac] [WordPress Trac] #34810: wp_calculate_image_srcset(): Reduce accepted aspect ratio difference
WordPress Trac
noreply at wordpress.org
Sat Nov 28 11:24:03 UTC 2015
#34810: wp_calculate_image_srcset(): Reduce accepted aspect ratio difference
----------------------------+-----------------------------
Reporter: jaspermdegroot | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
Currently images are included in the `srcset` if the aspect ratio
difference is smaller than 0.01. This number seems too high.
See this issue on the Responsive Images plugin support forum:
[https://wordpress.org/support/topic/when-crops-sizes-are-missingrandom-
image-selected-in-srcset?replies=7#post-7713923].
The `src` image is 380x256, hard cropped. A hard cropped 480w image would
be 480x323, but we do include the 480x319 soft cropped image in the
`srcset`. A difference in height of 4px while only 100px wider is too
much.
I looked at the PR in the plugin repo where the value of 0.01 was
introduced ([https://github.com/ResponsiveImagesCG/wp-tevko-responsive-
images/pull/140]) to see if there was any reason to use this particular
value, but it appears to be a matter of playing safe when it comes to not
excluding images from the `srcset`.
I suggest to change 0.01 to 0.005.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34810>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list