Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: image_downsize

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
56
57      if ( !wp_attachment_is_image($id) )
58           return false;
59
60      $img_url = wp_get_attachment_url($id);
61      $meta = wp_get_attachment_metadata($id);
62      $width = $height = 0;
63
64      // plugins can use this to provide resize services
65      if ( $out = apply_filters('image_downsize', false, $id, $size) )
66           return $out;
67
68      // try for a new style intermediate size
69      if ( $intermediate = image_get_intermediate_size($id, $size) ) {
70           $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
71           $width = $intermediate['width'];
72           $height = $intermediate['height'];
73      }
74      elseif ( $size == 'thumbnail' ) {