Core Function
View Source on Trac ↗ wp_constrain_dimensions()
wp_constrain_dimensions(
mixed $current_width,
mixed $current_height,
mixed $max_width = 0,
mixed $max_height = 0
) Calculates the new dimensions for a down-sampled image.
Parameters 2 required
| Name / Type | Description |
|---|---|
| $current_width int | Current width of the image. Required |
| $current_height int | Current height of the image. Required |
| $max_width int | Optional. Max width in pixels to constrain to. Default 0. |
| $max_height int | Optional. Max height in pixels to constrain to. Default 0. |
Return Value
(int[])
int[] {
An array of width and height values.
Function Information
Since Version
2.5.0
Source File
wp-includes/media.php
Advertisement