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
128      if ( !wp_attachment_is_image($id) )
129           return false;
130
131      $img_url = wp_get_attachment_url($id);
132      $meta = wp_get_attachment_metadata($id);
133      $width = $height = 0;
134      $is_intermediate = false;
135
136      // plugins can use this to provide resize services
137      if ( $out = apply_filters('image_downsize', false, $id, $size) )
138           return $out;
139
140      // try for a new style intermediate size
141      if ( $intermediate = image_get_intermediate_size($id, $size) ) {
142           $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
143           $width = $intermediate['width'];
144           $height = $intermediate['height'];
145           $is_intermediate = true;
146      }