WordPress.org

Make WordPress Core

Ticket #12268: consistent_image_resize_failure.12268.diff

File consistent_image_resize_failure.12268.diff, 1.1 KB (added by filosofo, 6 years ago)
  • wp-includes/media.php

     
    348348 * @param string $suffix Optional. File Suffix. 
    349349 * @param string $dest_path Optional. New image file path. 
    350350 * @param int $jpeg_quality Optional, default is 90. Image quality percentage. 
    351  * @return mixed WP_Error on failure. String with new destination path. Array of dimensions from {@link image_resize_dimensions()} 
     351 * @return mixed WP_Error on failure. String with new destination path. 
    352352 */ 
    353353function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { 
    354354 
     
    363363 
    364364        $dims = image_resize_dimensions($orig_w, $orig_h, $max_w, $max_h, $crop); 
    365365        if ( !$dims ) 
    366                 return $dims; 
     366                return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') ); 
    367367        list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims; 
    368368 
    369369        $newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );