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

This hook occurs 2 times in this file.

Line Code
424      $msg = '';
425
426      if ( !is_array($backup_sizes) ) {
427           $msg->error = __('Cannot load image metadata.');
428           return $msg;
429      }
430
431      $parts = pathinfo($file);
432      $suffix = time() . rand(100, 999);
433      $default_sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') );
434
435      if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) {
436           $data = $backup_sizes['full-orig'];
437
438           if ( $parts['basename'] != $data['file'] ) {
439                if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
440                     // delete only if it's edited image
441                     if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) {
442                          $delpath = apply_filters('wp_delete_file', $file);
 
Line Code
596
597           $meta['file'] = _wp_relative_upload_path($new_path);
598           $meta['width'] = imagesx($img);
599           $meta['height'] = imagesy($img);
600
601           list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96);
602           $meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
603
604           if ( $success && ('nothumb' == $target || 'all' == $target) ) {
605                $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') );
606                if ( 'nothumb' == $target )
607                     $sizes = array_diff( $sizes, array('thumbnail') );
608           }
609
610           $return->fw = $meta['width'];
611           $return->fh = $meta['height'];
612      } elseif ( 'thumbnail' == $target ) {
613           $sizes = array( 'thumbnail' );
614           $success = $delete = $nocrop = true;