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 |
---|---|
174 | * down-sizing the image, returning that value as output instead. |
175 | * |
176 | * @since 2.5.0 |
177 | * |
178 | * @param bool $downsize Whether to short-circuit the image downsize. Default false. |
179 | * @param int $id Attachment ID for image. |
180 | * @param array|string $size Size of image. Image size or array of width and height values (in that order). |
181 | * Default 'medium'. |
182 | */ |
183 | if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) { |
184 | return $out; |
185 | } |
186 |
|
187 | $img_url = wp_get_attachment_url($id); |
188 | $meta = wp_get_attachment_metadata($id); |
189 | $width = $height = 0; |
190 | $is_intermediate = false; |
191 | $img_url_basename = wp_basename($img_url); |
192 |
|
Line | Code |
3115 | unset( $possible_sizes['full'] ); |
3116 |
|
3117 | // Loop through all potential sizes that may be chosen. Try to do this with some efficiency. |
3118 | // First: run the image_downsize filter. If it returns something, we can use its data. |
3119 | // If the filter does not return something, then image_downsize() is just an expensive |
3120 | // way to check the image metadata, which we do second. |
3121 | foreach ( $possible_sizes as $size => $label ) { |
3122 |
|
3123 | /** This filter is documented in wp-includes/media.php */ |
3124 | if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) { |
3125 | if ( ! $downsize[3] ) |
3126 | continue; |
3127 | $sizes[ $size ] = array( |
3128 | 'height' => $downsize[2], |
3129 | 'width' => $downsize[1], |
3130 | 'url' => $downsize[0], |
3131 | 'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape', |
3132 | ); |
3133 | } elseif ( isset( $meta['sizes'][ $size ] ) ) { |