image_resize_dimensions filter-hookWP 3.4.0

Filters whether to preempt calculating the image resize dimensions.

Returning a non-null value from the filter will effectively short-circuit image_resize_dimensions(), returning that value instead.

Usage

add_filter( 'image_resize_dimensions', 'wp_kama_image_resize_dimensions_filter', 10, 6 );

/**
 * Function for `image_resize_dimensions` filter-hook.
 * 
 * @param null|mixed $null   Whether to preempt output of the resize dimensions.
 * @param int        $orig_w Original width in pixels.
 * @param int        $orig_h Original height in pixels.
 * @param int        $dest_w New width in pixels.
 * @param int        $dest_h New height in pixels.
 * @param bool|array $crop   Whether to crop image to specified width and height or resize. An array can specify positioning of the crop area.
 *
 * @return null|mixed
 */
function wp_kama_image_resize_dimensions_filter( $null, $orig_w, $orig_h, $dest_w, $dest_h, $crop ){

	// filter...
	return $null;
}
$null(null|mixed)
Whether to preempt output of the resize dimensions.
$orig_w(int)
Original width in pixels.
$orig_h(int)
Original height in pixels.
$dest_w(int)
New width in pixels.
$dest_h(int)
New height in pixels.
$crop(true|false|array)
Whether to crop image to specified width and height or resize. An array can specify positioning of the crop area.
Default: false

Changelog

Since 3.4.0 Introduced.

Where the hook is called

image_resize_dimensions()
image_resize_dimensions
wp-includes/media.php 564
$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );

Where the hook is used in WordPress

Usage not found.