wp_expand_dimensions

Definition:
function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) {}

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

Parameters

  • int $example_width: The width of an example embed.
  • int $example_height: The height of an example embed.
  • int $max_width: The maximum allowed width.
  • int $max_height: The maximum allowed height.

Return values

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

Source code

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 );

}

3643

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: