Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: thumbnail_filename

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
2268                     $image_ratio = $image_height / $image_new_height;
2269                     $image_new_width = $image_width / $image_ratio;
2270                     //height > width
2271                }
2272
2273                $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);
2274                @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );
2275
2276                // If no filters change the filename, we'll do a default transformation.
2277                if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
2278                     $thumb = preg_replace( '!(\.[^.]+)?$!', '.thumbnail' . '$1', basename( $file ), 1 );
2279
2280                $thumbpath = str_replace( basename( $file ), $thumb, $file );
2281
2282                // move the thumbnail to its final destination
2283                if ( $type[2] == 1 ) {
2284                     if (!imagegif( $thumbnail, $thumbpath ) ) {
2285                          $error = __( "Thumbnail path invalid" );
2286                     }