On this page
wp_shrink_dimensions( int $width, int $height, int $wmax = 128, int $hmax = 96 ): array
This function has been deprecated. Use wp_constrain_dimensions() instead.
Calculates the new dimensions for a downsampled image.
Description
See also
Parameters
$widthint Required-
Current width of the image
$heightint Required-
Current height of the image
$wmaxint Optional-
Maximum wanted width
Default:
128 $hmaxint Optional-
Maximum wanted height
Default:
96
Return
array Shrunk dimensions (width, height).
Source
File: wp-admin/includes/deprecated.php. View all references
function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' );
return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_constrain_dimensions() wp-includes/media.php | Calculates the new dimensions for a down-sampled image. |
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Use wp_constrain_dimensions() |
| 2.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_shrink_dimensions