Make WordPress Core


Ignore:
Timestamp:
04/22/2013 08:28:05 PM (13 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-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
Note: See TracChangeset for help on using the changeset viewer.