Incorrect WP_Error in image_resize
|Reported by:||mzaweb||Owned by:|
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.
Change History (9)
comment:2 follow-up: ↓ 4 @SergeyBiryukov — 3 years ago
- Keywords has-patch added
- Version changed from 3.3 to 3.2.1