[wp-trac] [WordPress Trac] #19118: Incorrect WP_Error in image_resize
WordPress Trac
wp-trac at lists.automattic.com
Wed Nov 2 19:40:20 UTC 2011
#19118: Incorrect WP_Error in image_resize
--------------------------+-----------------------------
Reporter: mzaweb | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.2.1
Severity: normal | Keywords:
--------------------------+-----------------------------
image_resize in wp-includes/media.php (line 417)
{{{
$dims = image_resize_dimensions($orig_w, $orig_h, $max_w, $max_h, $crop);
if ( !$dims )
return new WP_Error( 'error_getting_dimensions', __('Could not
calculate resized image dimensions') );
}}}
But image_resize_dimensions return false if the new dimensions are bigger
or equal the old ones, assuming that you won't want to resize the image.
{{{
// 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;
}}}
If this is the intended functionality, it shouldn't throw a WP_Error. I
think the check for if we want to resize or not should be done in
image_resize instead.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19118>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list