W3cubDocs

/WordPress

get_udims( int $width, int $height ): array

Calculated the new dimensions for a downsampled image.

Description

See also

Parameters

$widthintrequired
Current width of the image
$heightintrequired
Current height of the image

Return

array Shrunk dimensions (width, height).

Source

function get_udims( $width, $height ) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_constrain_dimensions()' );
	return wp_constrain_dimensions( $width, $height, 128, 96 );
}

Changelog

Version Description
3.5.0 Use wp_constrain_dimensions()
2.0.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_udims