WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/23/2009 06:39:31 PM (12 years ago)
Author:
ryan
Message:

Retunr WP_Error from wp_crop_image() and image_resize(). Props mdwaffe. fixes #9922

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-header.php

    r11383 r12524  
    361361            $oitar = $width / HEADER_IMAGE_WIDTH;
    362362            $image = wp_crop_image($file, 0, 0, $width, $height, HEADER_IMAGE_WIDTH, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
     363            if ( is_wp_error( $image ) )
     364                wp_die( __( 'Image could not be processed.  Please go back and try again.' ), __( 'Image Processing Error' ) );
     365
    363366            $image = apply_filters('wp_create_file_in_uploads', $image, $id); // For replication
    364367
     
    415418
    416419        $cropped = wp_crop_image($_POST['attachment_id'], $_POST['x1'], $_POST['y1'], $_POST['width'], $_POST['height'], HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT);
     420        if ( is_wp_error( $cropped ) )
     421            wp_die( __( 'Image could not be processed.  Please go back and try again.' ), __( 'Image Processing Error' ) );
     422
    417423        $cropped = apply_filters('wp_create_file_in_uploads', $cropped, $_POST['attachment_id']); // For replication
    418424
Note: See TracChangeset for help on using the changeset viewer.