Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: intermediate_image_sizes

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
97           // Make the file path relative to the upload dir
98           $metadata['file'] = _wp_relative_upload_path($file);
99
100           // make thumbnails and other intermediate sizes
101           global $_wp_additional_image_sizes;
102           $temp_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
103           if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
104                $temp_sizes = array_merge( $temp_sizes, array_keys( $_wp_additional_image_sizes ) );
105
106           $temp_sizes = apply_filters( 'intermediate_image_sizes', $temp_sizes );
107
108           foreach ( $temp_sizes as $s ) {
109                $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => FALSE );
110                if ( isset( $_wp_additional_image_sizes[$s]['width'] ) )
111                     $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes
112                else
113                     $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options
114                if ( isset( $_wp_additional_image_sizes[$s]['height'] ) )
115                     $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes