Make WordPress Core


Ignore:
Timestamp:
04/22/2013 08:28:05 PM (14 years ago)
Author:
nacin
Message:

Image editors: multi_resize() should require height and width. Crop is now optional and defaults to false. props DH-Shredder. fixes #23884.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-image-editor-imagick.php

    r23750 r24055  
    246246         * multiple sizes from single source.
    247247         *
    248          * @since 3.5.0
    249          * @access public
    250          *
    251          * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
     248         * 'width' and 'height' are required.
     249         * 'crop' defaults to false when not provided.
     250         *
     251         * @since 3.5.0
     252         * @access public
     253         *
     254         * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
    252255         * @return array
    253256         */
    … …  
    260263                        if ( ! $this->image )
    261264                                $this->image = $orig_image->getImage();
     265
     266                        if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
     267                                continue;
     268
     269                        if ( ! isset( $size_data['crop'] ) )
     270                                $size_data['crop'] = false;
    262271
    263272                        $resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
Note: See TracChangeset for help on using the changeset viewer.