WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
192 | * down-sizing the image, returning that value as output instead. |
193 | * |
194 | * @since 2.5.0 |
195 | * |
196 | * @param bool $downsize Whether to short-circuit the image downsize. Default false. |
197 | * @param int $id Attachment ID for image. |
198 | * @param array|string $size Size of image. Image size or array of width and height values (in that order). |
199 | * Default 'medium'. |
200 | */ |
201 | $out = apply_filters( 'image_downsize', false, $id, $size ); |
202 |
|
203 | if ( $out ) { |
204 | return $out; |
205 | } |
206 |
|
207 | $img_url = wp_get_attachment_url( $id ); |
208 | $meta = wp_get_attachment_metadata( $id ); |
209 | $width = 0; |
210 | $height = 0; |
Line | Code |
3472 | unset( $possible_sizes['full'] ); |
3473 |
|
3474 | // Loop through all potential sizes that may be chosen. Try to do this with some efficiency. |
3475 | // First: run the image_downsize filter. If it returns something, we can use its data. |
3476 | // If the filter does not return something, then image_downsize() is just an expensive |
3477 | // way to check the image metadata, which we do second. |
3478 | foreach ( $possible_sizes as $size => $label ) { |
3479 |
|
3480 | /** This filter is documented in wp-includes/media.php */ |
3481 | $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ); |
3482 |
|
3483 | if ( $downsize ) { |
3484 | if ( empty( $downsize[3] ) ) { |
3485 | continue; |
3486 | } |
3487 |
|
3488 | $sizes[ $size ] = array( |
3489 | 'height' => $downsize[2], |
3490 | 'width' => $downsize[1], |