Make WordPress Core

Ticket #26823: multi_resize_null_support_with_check_for_both_null.patch

File multi_resize_null_support_with_check_for_both_null.patch, 2.0 KB (added by pbearne, 11 years ago)

the patch with NULL/0 value for both height and width

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

     
    205205                $orig_size = $this->size;
    206206
    207207                foreach ( $sizes as $size => $size_data ) {
    208                         if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
     208                        // that we don't have NULL or 0 for both values
     209                        if ( 0 == ( absint( $size_data['width'] ) + absint( $size_data['height'] ) ) ){
    209210                                continue;
     211                        }
    210212
    211                         if ( ! isset( $size_data['crop'] ) )
     213                        if ( ! isset( $size_data['crop'] ) ){
    212214                                $size_data['crop'] = false;
     215                        }
    213216
    214                         $image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
     217                        $image = $this->_resize( absint( $size_data['width'] ), absint( $size_data['height'] ), $size_data['crop'] );
    215218
    216219                        if( ! is_wp_error( $image ) ) {
    217220                                $resized = $this->_save( $image );
  • wp-includes/class-wp-image-editor-imagick.php

     
    272272                        if ( ! $this->image )
    273273                                $this->image = $orig_image->getImage();
    274274
    275                         if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) )
     275                        // that we don't have NULL or 0 for both values
     276                        if ( 0 == ( absint( $size_data['width'] ) + absint( $size_data['height'] ) ) ){
    276277                                continue;
     278                        }
    277279
    278                         if ( ! isset( $size_data['crop'] ) )
     280                        if ( ! isset( $size_data['crop'] ) ){
    279281                                $size_data['crop'] = false;
     282                        }
    280283
    281                         $resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
     284                        $resize_result = $this->resize( absint( $size_data['width'] ), absint( $size_data['height'] ), $size_data['crop'] );
    282285
    283286                        if( ! is_wp_error( $resize_result ) ) {
    284287                                $resized = $this->_save( $this->image );