wp_constrain_dimensions
wp_constrain_dimensions ( $current_width, $current_height, $max_width = 0, $max_height = 0 )
Parameters:- (int) current_width Current width of the image.
- (int) current_height Current height of the image.
- (int) max_width Optional. Max width in pixels to constrain to. Default 0.
- (int) max_height Optional. Max height in pixels to constrain to. Default 0.
Returns:- (int[]) { An array of width and height values. @type int $0 The width in pixels. @type int $1 The height in pixels. }
Defined at: - Introduced in WordPress: 2.5.0
- Deprecated in WordPress: —
Description
Calculates the new dimensions for a down-sampled image.If either width or height are empty, no constraint is applied on
that dimension.