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.
| Line | Code |
|---|---|
| 299 | // get an image to represent an attachment - a mime icon for files, thumbnail or intermediate size for images |
| 300 | // returns an array (url, width, height), or false if no image is available |
| 301 | function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) { |
| 302 | |
| 303 | // get a thumbnail or intermediate image if there is one |
| 304 | if ( $image = image_downsize($attachment_id, $size) ) |
| 305 | return $image; |
| 306 | |
| 307 | if ( $icon && $src = wp_mime_type_icon($attachment_id) ) { |
| 308 | $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' ); |
| 309 | $src_file = $icon_dir . '/' . basename($src); |
| 310 | @list($width, $height) = getimagesize($src_file); |
| 311 | } |
| 312 | if ( $src && $width && $height ) |
| 313 | return array( $src, $width, $height ); |
| 314 | return false; |
| 315 | } |
| 316 | |
| 317 | // as per wp_get_attachment_image_src, but returns an <img> tag |