Skip to content

Commit a45a03c

Browse files
committed
Consistently return WP_Error on failure in image_resize. props filosofo, fixes #12268
git-svn-id: https://develop.svn.wordpress.org/trunk@14105 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7f994ed commit a45a03c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

wp-includes/media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = fal
376376
* @param string $suffix Optional. File Suffix.
377377
* @param string $dest_path Optional. New image file path.
378378
* @param int $jpeg_quality Optional, default is 90. Image quality percentage.
379-
* @return mixed WP_Error on failure. String with new destination path. Array of dimensions from {@link image_resize_dimensions()}
379+
* @return mixed WP_Error on failure. String with new destination path.
380380
*/
381381
function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
382382

@@ -391,7 +391,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
391391

392392
$dims = image_resize_dimensions($orig_w, $orig_h, $max_w, $max_h, $crop);
393393
if ( !$dims )
394-
return $dims;
394+
return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') );
395395
list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims;
396396

397397
$newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );

0 commit comments

Comments
 (0)