image_downsize WordPress Filter Hook

This hook is used to downsize an image that has been uploaded to WordPress. It allows you to set a maximum width and height for the image, and will automatically crop and resize the image to fit within those dimensions. This is useful for creating thumbnails or for displaying images in a fixed-size container.

apply_filters( 'image_downsize', bool|array $downsize, int $id, string|int[] $size ) #

Filters whether to preempt the output of image_downsize().


Description

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


Top ↑

Parameters

$downsize

(bool|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).


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More