Filters whether to preempt calculating the image resize dimensions.
Description
Returning a non-null value from the filter will effectively short-circuit image_resize_dimensions() , returning that value instead.
Parameters
$nullnull|mixed- Whether to preempt output of the resize dimensions.
$orig_wint- Original width in pixels.
$orig_hint- Original height in pixels.
$dest_wint- New width in pixels.
$dest_hint- New height in pixels.
$cropbool|array- Whether to crop image to specified width and height or resize.
An array can specify positioning of the crop area. Default false.
Source
$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |
Example migrated from Codex:
This example filters the image resizing dimensions to force WordPress to crop thumbnails by keeping the top of the image, instead of the default center.