Welcome, visitor! Log in
 

Source View: image_resize_dimensions

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
441       *
442       * @param null|mixed $null   Whether to preempt output of the resize dimensions.
443       * @param int        $orig_w Original width in pixels.
444       * @param int        $orig_h Original height in pixels.
445       * @param int        $dest_w New width in pixels.
446       * @param int        $dest_h New height in pixels.
447       * @param bool|array $crop   Whether to crop image to specified height and width or resize.
448       *                           An array can specify positioning of the crop area. Default false.
449       */
450      $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
451      if ( null !== $output )
452           return $output;
453
454      if ( $crop ) {
455           // crop the largest possible portion of the original image that we can size to $dest_w x $dest_h
456           $aspect_ratio = $orig_w / $orig_h;
457           $new_w = min($dest_w, $orig_w);
458           $new_h = min($dest_h, $orig_h);
459