WordPress.org

Make WordPress Core

Changeset 45543


Ignore:
Timestamp:
06/16/2019 01:32:16 AM (6 months ago)
Author:
azaozz
Message:

Media: Ignore errors coming from image_resize_dimensions() when creating sub-sizes (for now). It returns false when the requested size is larger than the original image and should be skipped. This triggers new WP_Error in WP_Image_Editor::resize().

See #40439.

File:
1 edited

Legend:

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

    r45540 r45543  
    236236
    237237                    if ( is_wp_error( $new_size_meta ) ) {
     238                        $error_code = $new_size_meta->get_error_code();
     239
     240                        if ( $error_code === 'error_getting_dimensions' ) {
     241                            // Ignore errors when `image_resize_dimensions()` returns false.
     242                            // They mean that the requested size is larger than the original image and should be skipped.
     243                            continue;
     244                        }
     245
    238246                        if ( empty( $image_meta['subsize_errors'] ) ) {
    239247                            $image_meta['subsize_errors'] = array();
     
    241249
    242250                        $error = array(
    243                             'error_code'    => $new_size_meta->get_error_code(),
     251                            'error_code'    => $error_code,
    244252                            'error_message' => $new_size_meta->get_error_message(),
    245253                        );
Note: See TracChangeset for help on using the changeset viewer.