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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
737                     $image_ratio = $image_height / $image_new_height;
738                     $image_new_width = $image_width / $image_ratio;
739                     //height > width
740                }
741
742                $thumbnail = imagecreatetruecolor($image_new_width, $image_new_height);
743                @ imagecopyresampled($thumbnail, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $image_attr[0], $image_attr[1]);
744
745                // If no filters change the filename, we'll do a default transformation.
746                if ( basename($file) == $thumb = apply_filters('thumbnail_filename', basename($file)) )
747                     $thumb = preg_replace('!(\.[^.]+)?$!', __('.thumbnail').'$1', basename($file), 1);
748
749                $thumbpath = str_replace(basename($file), $thumb, $file);
750
751                // move the thumbnail to it's final destination
752                if ($type[2] == 1) {
753                     if (!imagegif($thumbnail, $thumbpath)) {
754                          $error = __("Thumbnail path invalid");
755                     }