WordPress.org

Make WordPress Core

Changeset 14105


Ignore:
Timestamp:
04/16/10 13:53:22 (4 years ago)
Author:
nacin
Message:

Consistently return WP_Error on failure in image_resize. props filosofo, fixes #12268

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r14035 r14105  
    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 */ 
    381381function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { 
     
    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 
Note: See TracChangeset for help on using the changeset viewer.