Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

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.

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
319 function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = false) {
320
321      if ($orig_w <= 0 || $orig_h <= 0)
322           return false;
323      // at least one of dest_w or dest_h must be specific
324      if ($dest_w <= 0 && $dest_h <= 0)
325           return false;
326
327      // plugins can use this to provide custom resize dimensions
328      $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
329      if ( null !== $output )
330           return $output;
331
332      if ( $crop ) {
333           // crop the largest possible portion of the original image that we can size to $dest_w x $dest_h
334           $aspect_ratio = $orig_w / $orig_h;
335           $new_w = min($dest_w, $orig_w);
336           $new_h = min($dest_h, $orig_h);
337