[wp-trac] [WordPress Trac] #35193: $image_ratio_compare variance increase

WordPress Trac noreply at wordpress.org
Mon Dec 21 22:50:28 UTC 2015


#35193: $image_ratio_compare variance increase
--------------------------+-----------------------------
 Reporter:  greenzilla    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  4.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I'm calling this a bug since I believe it is not the desired natural
 functionality for my case which I imagine could be the similar case for
 others.

 {{{
 Line 1065 in wp-includes\media.php
 }}}

 {{{#!php
 <?php
 if ( abs( $image_ratio - $image_ratio_compare ) < 0.002 ) {
 }}}

 Should be increased (for example):

 {{{#!php
 <?php
 if ( abs( $image_ratio - $image_ratio_compare ) < 0.01 ) {

 }}}

 For testing purposes, my media settings have custom image sizes created
 for 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900 and 1,000.
 (some of these sizes are set as the default image sizes).

 I am not cropping any of the images (so not changing the aspect ratio).
 However, this variance is not allowing for certain sizes to be returned in
 the $srcset. It is my understanding that this variance is to ensure
 cropped images are not returned. However, I am not being returned all the
 images that are within the native ratio.

 I believe there should at least be a filter to adjust this variance.

 I used 0.01 in my tests to return all the images with the native ratio. My
 tests showed the highest deviation was 0.00941.

 I have tested this with vertical, horizontal and square images.

 Do note that in my environment, I am using 'WP_Image_Editor_Imagick' as
 the image editor via the 'wp_image_editors' filter.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35193>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list