Warning: This function has been deprecated. Use wp_constrain_dimensions() instead.

get_udims() WordPress Function

get_udims() is a WordPress function that allows you to get the dimensions of an image stored in the media library. This is useful if you need to know the width and height of an image for use in a theme or plugin. The function returns an array with the width and height of the image.

get_udims( int $width, int $height ) #

Calculated the new dimensions for a downsampled image.


Description

Top ↑

See also


Top ↑

Parameters

$width

(int)(Required)Current width of the image

$height

(int)(Required)Current height of the image


Top ↑

Return

(array) Shrunk dimensions (width, height).


Top ↑

Source

File: wp-admin/includes/deprecated.php

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


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Use wp_constrain_dimensions()
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More