Ticket #26823: multi_resize_null_support.patch
File multi_resize_null_support.patch, 2.9 KB (added by , 11 years ago) |
---|
-
wp-includes/class-wp-image-editor-gd.php
193 193 * An array of image size arrays. Default sizes are 'small', 'medium', 'large'. 194 194 * 195 195 * @type array $size { 196 * @type int $width Image width.197 * @type int $height Image height.196 * @type int/null $width Image width. 197 * @type int/null $height Image height. 198 198 * @type bool $crop Optional. Whether to crop the image. Default false. 199 199 * } 200 200 * } … … 205 205 $orig_size = $this->size; 206 206 207 207 foreach ( $sizes as $size => $size_data ) { 208 if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) ) 209 continue; 208 // are both width and height set 209 if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) ){ 210 // check both aren't null 211 if( null === $size_data['width'] && null === $size_data['height']){ 212 continue; 213 } 210 214 215 // if check that only width is null and set to max int if so 216 if( null === $size_data['width'] ){ 217 $size_data['width'] = PHP_INT_MAX-1; 218 } 219 // if check that only height is null and set to max int if so 220 if ( null === $size_data['height'] ){ 221 $size_data['height'] = PHP_INT_MAX-1; 222 } 223 } 224 211 225 if ( ! isset( $size_data['crop'] ) ) 212 226 $size_data['crop'] = false; 213 227 -
wp-includes/class-wp-image-editor-imagick.php
256 256 * An array of image size arrays. Default sizes are 'small', 'medium', 'large'. 257 257 * 258 258 * @type array $size { 259 * @type int $width Image width.260 * @type int $height Image height.259 * @type int/null $width Image width. 260 * @type int/null $height Image height. 261 261 * @type bool $crop Optional. Whether to crop the image. Default false. 262 262 * } 263 263 * } … … 272 272 if ( ! $this->image ) 273 273 $this->image = $orig_image->getImage(); 274 274 275 if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) ) 276 continue; 275 if ( ! ( isset( $size_data['width'] ) && isset( $size_data['height'] ) ) ){ 276 // check both aren't null 277 if( null === $size_data['width'] && null === $size_data['height']){ 278 continue; 279 } 277 280 281 // if check that only width is null and set to max int if so 282 if( null === $size_data['width'] ){ 283 $size_data['width'] = PHP_INT_MAX-1; 284 } 285 // if check that only height is null and set to max int if so 286 if ( null === $size_data['height'] ){ 287 $size_data['height'] = PHP_INT_MAX-1; 288 } 289 } 290 278 291 if ( ! isset( $size_data['crop'] ) ) 279 292 $size_data['crop'] = false; 280 293