diff --git a/wp-includes/class-wp-image-editor-gd.php b/wp-includes/class-wp-image-editor-gd.php index 904cecd876..4b0fdae804 100644 --- a/wp-includes/class-wp-image-editor-gd.php +++ b/wp-includes/class-wp-image-editor-gd.php @@ -178,10 +178,13 @@ class WP_Image_Editor_GD extends WP_Image_Editor { * Processes current image and saves to disk * multiple sizes from single source. * + * 'width' and 'height' are required. + * 'crop' defaults to false when not provided. + * * @since 3.5.0 * @access public * - * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... } + * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... } * @return array */ public function multi_resize( $sizes ) { @@ -189,6 +192,12 @@ class WP_Image_Editor_GD extends WP_Image_Editor { $orig_size = $this->size; foreach ( $sizes as $size => $size_data ) { + if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) ) + continue; + + if ( ! isset( $size_data['crop'] ) ) + $size_data['crop'] = false; + $image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] ); if( ! is_wp_error( $image ) ) { diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index 457b7fc5f0..653eb8a6a5 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -245,10 +245,13 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * Processes current image and saves to disk * multiple sizes from single source. * + * 'width' and 'height' are required. + * 'crop' defaults to false when not provided. + * * @since 3.5.0 * @access public * - * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... } + * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... } * @return array */ public function multi_resize( $sizes ) { @@ -260,6 +263,12 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { if ( ! $this->image ) $this->image = $orig_image->getImage(); + if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) ) + continue; + + if ( ! isset( $size_data['crop'] ) ) + $size_data['crop'] = false; + $resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] ); if( ! is_wp_error( $resize_result ) ) { diff --git a/wp-includes/class-wp-image-editor.php b/wp-includes/class-wp-image-editor.php index 112560213c..1d7b80e45d 100644 --- a/wp-includes/class-wp-image-editor.php +++ b/wp-includes/class-wp-image-editor.php @@ -97,11 +97,14 @@ abstract class WP_Image_Editor { * Processes current image and saves to disk * multiple sizes from single source. * + * 'width' and 'height' are required. + * 'crop' defaults to false when not provided. + * * @since 3.5.0 * @access public * @abstract * - * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... } + * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... } * @return array */ abstract public function multi_resize( $sizes );