WordPress at a glance
function is not described

wp_expand_dimensions() WP 2.9.0

Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.

No Hooks.


Array. The maximum possible width and height based on the example ratio.


wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height );
$example_width(int) (required)
The width of an example embed.
$example_height(int) (required)
The height of an example embed.
$max_width(int) (required)
The maximum allowed width.
$max_height(int) (required)
The maximum allowed height.


  • See: wp_constrain_dimensions()


Since 2.9.0 Introduced.

Code of wp expand dimensions: wp-includes/media.php WP 5.2.2

function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) {
	$example_width  = (int) $example_width;
	$example_height = (int) $example_height;
	$max_width      = (int) $max_width;
	$max_height     = (int) $max_height;

	return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height );