Make WordPress Core

Ticket #23884: 23884.diff

File 23884.diff, 3.1 KB (added by dh-shredder, 13 years ago)

edit: comment correction

  • wp-includes/class-wp-image-editor-gd.php

    diff --git wp-includes/class-wp-image-editor-gd.php wp-includes/class-wp-image-editor-gd.php
    index 050e696..bb69b62 100644
    class WP_Image_Editor_GD extends WP_Image_Editor { 
    173173         * Processes current image and saves to disk
    174174         * multiple sizes from single source.
    175175         *
     176         * 'width' and 'height' are required.
     177         * 'crop' defaults to false when not provided.
     178         *
    176179         * @since 3.5.0
    177180         * @access public
    178181         *
    179          * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
     182         * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
    180183         * @return array
    181184         */
    182185        public function multi_resize( $sizes ) {
    class WP_Image_Editor_GD extends WP_Image_Editor { 
    184187                $orig_size = $this->size;
    185188
    186189                foreach ( $sizes as $size => $size_data ) {
     190                        if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
     191                                continue;
     192
     193                        if ( ! isset( $size_data['crop'] ) )
     194                                $size_data['crop'] = false;
     195
    187196                        $image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
    188197
    189198                        if( ! is_wp_error( $image ) ) {
  • wp-includes/class-wp-image-editor-imagick.php

    diff --git wp-includes/class-wp-image-editor-imagick.php wp-includes/class-wp-image-editor-imagick.php
    index 457b7fc..653eb8a 100644
    class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    245245         * Processes current image and saves to disk
    246246         * multiple sizes from single source.
    247247         *
     248         * 'width' and 'height' are required.
     249         * 'crop' defaults to false when not provided.
     250         *
    248251         * @since 3.5.0
    249252         * @access public
    250253         *
    251          * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
     254         * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
    252255         * @return array
    253256         */
    254257        public function multi_resize( $sizes ) {
    class WP_Image_Editor_Imagick extends WP_Image_Editor { 
    260263                        if ( ! $this->image )
    261264                                $this->image = $orig_image->getImage();
    262265
     266                        if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
     267                                continue;
     268
     269                        if ( ! isset( $size_data['crop'] ) )
     270                                $size_data['crop'] = false;
     271
    263272                        $resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
    264273
    265274                        if( ! is_wp_error( $resize_result ) ) {
  • wp-includes/class-wp-image-editor.php

    diff --git wp-includes/class-wp-image-editor.php wp-includes/class-wp-image-editor.php
    index 1125602..1d7b80e 100644
    abstract class WP_Image_Editor { 
    9797         * Processes current image and saves to disk
    9898         * multiple sizes from single source.
    9999         *
     100         * 'width' and 'height' are required.
     101         * 'crop' defaults to false when not provided.
     102         *
    100103         * @since 3.5.0
    101104         * @access public
    102105         * @abstract
    103106         *
    104          * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
     107         * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
    105108         * @return array
    106109         */
    107110        abstract public function multi_resize( $sizes );