Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_thumbnail_creation_size_limit

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
2195      $metadata = array();
2196      if ( preg_match('!^image/!', get_post_mime_type( $attachment )) ) {
2197           $imagesize = getimagesize($file);
2198           $metadata['width'] = $imagesize['0'];
2199           $metadata['height'] = $imagesize['1'];
2200           list($uwidth, $uheight) = get_udims($metadata['width'], $metadata['height']);
2201           $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
2202           $metadata['file'] = $file;
2203
2204           $max = apply_filters( 'wp_thumbnail_creation_size_limit', 3 * 1024 * 1024, $attachment_id, $file );
2205
2206           if ( $max < 0 || $metadata['width'] * $metadata['height'] < $max ) {
2207                $max_side = apply_filters( 'wp_thumbnail_max_side_length', 128, $attachment_id, $file );
2208                $thumb = wp_create_thumbnail( $file, $max_side );
2209
2210                if ( @file_exists($thumb) )
2211                     $metadata['thumb'] = basename($thumb);
2212           }
2213      }