Description
Retrieve calculated resized dimensions for use in imagecopyresampled().
Calculate dimensions and coordinates for a resized image that fits within a specified width and height. If $crop is true, the largest matching central portion of the image will be cropped out and resized to the required size.
Usage
<?php image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop ); ?>
Parameters
- $orig_w
- (int) (required) Original width.
- Default: None
- $orig_h
- (int) (required) Original height.
- Default: None
- $dest_w
- (int) (required) New width.
- Default: None
- $dest_h
- (int) (required) New height.
- Default: None
- $crop
- (boolean) (optional) Optional, default is false. Whether to crop image or resize.
- Default: false
Return Values
- (boolean|array)
- False, on failure. Returned array matches parameters for imagecopyresampled() PHP function.
Change Log
Since: 2.5
Source File
image_resize_dimensions() is located in wp-includes/media.php