Make WordPress Core

Changeset 22192


Ignore:
Timestamp:
10/11/2012 06:59:41 PM (14 years ago)
Author:
ryan
Message:

Check for WP_Error return from WP_Image_Editor::get_instance().

Props markoheijnen
see #6821

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image-edit.php

    r22094 r22192  
    569569
    570570        $img = WP_Image_Editor::get_instance( _load_image_to_edit_path( $post_id, 'full' ) );
    571         if ( !$img ) {
     571        if ( is_wp_error( $img ) ) {
    572572                $return->error = esc_js( __('Unable to create new image.') );
    573573                return $return;
  • trunk/wp-admin/includes/image.php

    r22094 r22192  
    3434
    3535        $editor = WP_Image_Editor::get_instance( $src_file );
     36        if ( is_wp_error( $editor ) )
     37                return $editor;
     38
    3639        $src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
    37 
    3840        if ( is_wp_error( $src ) )
    3941                return $src;
     
    9597
    9698                $editor = WP_Image_Editor::get_instance( $file );
    97                 $metadata['sizes'] = $editor->multi_resize( $sizes );
     99
     100                if ( ! is_wp_error( $editor ) )
     101                        $metadata['sizes'] = $editor->multi_resize( $sizes );
    98102
    99103                // fetch additional metadata from exif/iptc
  • trunk/wp-includes/media.php

    r22184 r22192  
    384384                $editor = WP_Image_Editor::get_instance( $file );
    385385
    386                 if ( is_wp_error( $editor->resize( $width, $height, $crop ) ) );
     386                if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) );
    387387                        return false;
    388388
Note: See TracChangeset for help on using the changeset viewer.