image_downsize filter-hookWP 2.5.0

Filters whether to preempt the output of image_downsize().

Returning a truthy value from the filter will effectively short-circuit down-sizing the image, returning that value instead.

Usage

add_filter( 'image_downsize', 'wp_kama_image_downsize_filter', 10, 3 );

/**
 * Function for `image_downsize` filter-hook.
 * 
 * @param bool|array   $downsize Whether to short-circuit the image downsize.
 * @param int          $id       Attachment ID for image.
 * @param string|int[] $size     Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
 *
 * @return bool|array
 */
function wp_kama_image_downsize_filter( $downsize, $id, $size ){

	// filter...
	return $downsize;
}
$downsize(true|false|array)
Whether to short-circuit the image downsize.
$id(int)
Attachment ID for image.
$size(string|int[])
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).

Changelog

Since 2.5.0 Introduced.

Where the hook is called

image_downsize()
image_downsize
wp_prepare_attachment_for_js()
image_downsize
wp-includes/media.php 207
$out = apply_filters( 'image_downsize', false, $id, $size );
wp-includes/media.php 4434
$downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size );

Where the hook is used in WordPress

Usage not found.