WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
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.
Line | Code |
---|---|
320 | function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = false) { |
321 |
|
322 | if ($orig_w <= 0 || $orig_h <= 0) |
323 | return false; |
324 | // at least one of dest_w or dest_h must be specific |
325 | if ($dest_w <= 0 && $dest_h <= 0) |
326 | return false; |
327 |
|
328 | // plugins can use this to provide custom resize dimensions |
329 | $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop ); |
330 | if ( null !== $output ) |
331 | return $output; |
332 |
|
333 | if ( $crop ) { |
334 | // crop the largest possible portion of the original image that we can size to $dest_w x $dest_h |
335 | $aspect_ratio = $orig_w / $orig_h; |
336 | $new_w = min($dest_w, $orig_w); |
337 | $new_h = min($dest_h, $orig_h); |
338 |
|