image_resize_dimensions


image_resize_dimensions ( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false )

Parameters:
  • (int) orig_w Original width in pixels.
  • (int) orig_h Original height in pixels.
  • (int) dest_w New width in pixels.
  • (int) dest_h New height in pixels.
  • (bool|array) crop { Optional. Image cropping behavior. If false, the image will be scaled (default). If true, image will be cropped to the specified dimensions using center positions. If an array, the image will be cropped using the array to specify the crop location: @type string $0 The x crop position. Accepts 'left' 'center', or 'right'. @type string $1 The y crop position. Accepts 'top', 'center', or 'bottom'. }
Returns:
  • (array|false) Returned array matches parameters for `imagecopyresampled()`. False on failure.
Defined at:

Description

Retrieves calculated resize dimensions for use in WP_Image_Editor.Calculates dimensions and coordinates for a resized image that fits within a specified width and height.

Related Functions

wp_image_src_get_dimensions, image_resize, wp_shrink_dimensions, image_size_input_fields, wp_constrain_dimensions

Top Google Results

User discussions

wpseek mobile