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
2179                     $image_ratio = $image_height / $image_new_height;
2180                     $image_new_width = $image_width / $image_ratio;
2181                     //height > width
2182                }
2183
2184                $thumbnail = imagecreatetruecolor( $image_new_width, $image_new_height);
2185                @ imagecopyresampled( $thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1] );
2186
2187                // If no filters change the filename, we'll do a default transformation.
2188                if ( basename( $file ) == $thumb = apply_filters( 'thumbnail_filename', basename( $file ) ) )
2189                     $thumb = preg_replace( '!(\.[^.]+)?$!', __( '.thumbnail' ).'$1', basename( $file ), 1 );
2190
2191                $thumbpath = str_replace( basename( $file ), $thumb, $file );
2192
2193                // move the thumbnail to it's final destination
2194                if ( $type[2] == 1 ) {
2195                     if (!imagegif( $thumbnail, $thumbpath ) ) {
2196                          $error = __( "Thumbnail path invalid" );
2197                     }