Make WordPress Core

Changeset 24055


Ignore:
Timestamp:
04/22/2013 08:28:05 PM (11 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.

Location:
trunk/wp-includes
Files:
3 edited

Legend:

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

    r23884 r24055  
    179179     * multiple sizes from single source.
    180180     *
    181      * @since 3.5.0
    182      * @access public
    183      *
    184      * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
     181     * 'width' and 'height' are required.
     182     * 'crop' defaults to false when not provided.
     183     *
     184     * @since 3.5.0
     185     * @access public
     186     *
     187     * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
    185188     * @return array
    186189     */
     
    190193
    191194        foreach ( $sizes as $size => $size_data ) {
     195            if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
     196                continue;
     197
     198            if ( ! isset( $size_data['crop'] ) )
     199                $size_data['crop'] = false;
     200
    192201            $image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
    193202
  • 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'] );
  • trunk/wp-includes/class-wp-image-editor.php

    r23750 r24055  
    9898     * multiple sizes from single source.
    9999     *
    100      * @since 3.5.0
    101      * @access public
    102      * @abstract
    103      *
    104      * @param array $sizes { {'width'=>int, 'height'=>int, 'crop'=>bool}, ... }
     100     * 'width' and 'height' are required.
     101     * 'crop' defaults to false when not provided.
     102     *
     103     * @since 3.5.0
     104     * @access public
     105     * @abstract
     106     *
     107     * @param array $sizes { {'width'=>int, 'height'=>int, ['crop'=>bool]}, ... }
    105108     * @return array
    106109     */
Note: See TracChangeset for help on using the changeset viewer.