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