WordPress.org

Make WordPress Core

Ticket #15989: media.php.patch

File media.php.patch, 845 bytes (added by ebababi, 2 years ago)

Add filter to hook image_resize_dimensions functionality

  • media.php

     
    327327 * portion of the image will be cropped out and resized to the required size. 
    328328 * 
    329329 * @since 2.5.0 
     330 * @uses apply_filters() Calls 'image_resize_dimensions' on $orig_w, $orig_h, $dest_w, $dest_h and 
     331 *              $crop to provide custom resize dimensions. 
    330332 * 
    331333 * @param int $orig_w Original width. 
    332334 * @param int $orig_h Original height. 
     
    343345        if ($dest_w <= 0 && $dest_h <= 0) 
    344346                return false; 
    345347 
     348        // plugins can use this to provide custom resize dimensions 
     349        $output = apply_filters('image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop); 
     350        if ( $output != null ) 
     351                return $output; 
     352 
    346353        if ( $crop ) { 
    347354                // crop the largest possible portion of the original image that we can size to $dest_w x $dest_h 
    348355                $aspect_ratio = $orig_w / $orig_h;