[wp-trac] [WordPress Trac] #19872: Add Hook/Filter to image_resize_dimensions in media.php

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 21 19:38:19 UTC 2012


#19872: Add Hook/Filter to image_resize_dimensions in media.php
-----------------------------+-----------------------------
 Reporter:  webbtj           |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:  3.3.1
 Severity:  normal           |   Keywords:
-----------------------------+-----------------------------
 It would be great if a hook, a filter, a global, an option, or something
 somewhere were created to allow the image_resize_dimensions() function in
 media.php to resize images to be larger than the original. In a typical
 scenario I can understand why you would not want to allow this, however
 there are rare circumstances where this would be helpful (generating a
 background image). Currently lines 349 and 350 of media.php read:
 {{{
 $new_w = min($dest_w, $orig_w);
 $new_h = min($dest_h, $orig_h);
 }}}
 and lines 378 to 380 read:
 {{{
 // if the resulting image would be the same size or larger we don't want
 to resize it
 if ( $new_w >= $orig_w && $new_h >= $orig_h )
         return false;
 }}}
 It would be great if we were provided a boolean to alter these two blocks,
 for example:
 {{{
 if($allow_resize){
         $new_w = $dest_w;
         $new_h = $dest_h;
 }else{
         $new_w = min($dest_w, $orig_w);
         $new_h = min($dest_h, $orig_h);
 }
 }}}
 ...
 {{{
 // if the resulting image would be the same size or larger we don't want
 to resize it
 if ( $new_w >= $orig_w && $new_h >= $orig_h && !$allow_resize)
         return false;
 }}}

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


More information about the wp-trac mailing list