[wp-trac] [WordPress Trac] #21714: Enable Intermediate choice in UI if Full Size Image is exact match to Intermediate Image

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 28 15:56:09 UTC 2012


#21714: Enable Intermediate choice in UI if Full Size Image is exact match to
Intermediate Image
-------------------------+-----------------------------
 Reporter:  andrewteg    |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  3.4.1
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 This is simply a minor usability enhancement for Media Gallery. If an
 image is uploaded that is exactly the same size as an intermediate image
 (300x300 = Medium for example) it is not a choice when inserting that
 image into a post. It would be nice if it was a choice pointing to the
 full/original image since full is the same size as the intermediate.

 It seems to be caused in the image_downsize function in /wp-
 includes/media.php because image_get_intermediate_size returns false.

 I believe image_downsize can be updated as such to provide this
 enhancement:

 Line 162 (if statement) Currently:
 {{{
         if ( !$width && !$height && isset($meta['width'], $meta['height'])
 ) {
                 // any other type: use the real image
                 $width = $meta['width'];
                 $height = $meta['height'];
         }
 }}}

 could be updated to read the intermediate width and height and set
 intermediate to true if it is an exact match to the original image:

 {{{
         if ( !$width && !$height && isset($meta['width'], $meta['height'])
 ) {
                 // any other type: use the real image
                 $width = $meta['width'];
                 $height = $meta['height'];
                 // add check for real image being exact match to
 intermediate image to enable intermediate choice in UI
                 if (isset($_wp_additional_image_sizes[$size])) {
                         $goal_width =
 intval($_wp_additional_image_sizes[$size]['width']);
                         $goal_height =
 intval($_wp_additional_image_sizes[$size]['height']);
                 } else {
                         $goal_width = get_option($size.'_size_w');
                         $goal_height = get_option($size.'_size_h');
                 }
                 if ($width == $goal_width && $height == $goal_height)
                         $is_intermediate = true;
         }

 }}}


 Thanks for considering, and hope I put this in the right place,
 Andrew

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21714>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list