wp_expand_dimensions

The timeline below displays how wordpress function wp_expand_dimensions has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Based on a supplied width/height example, returns the biggest possible dimensions based on the max width/height.
 *
 * @since 2.9.0
 *
 * @see wp_constrain_dimensions()
 *
 * @param int $example_width  The width of an example embed.
 * @param int $example_height The height of an example embed.
 * @param int $max_width      The maximum allowed width.
 * @param int $max_height     The maximum allowed height.
 * @return int[] {
 *     An array of maximum width and height values.
 *
 *     @type int $0 The maximum width in pixels.
 *     @type int $1 The maximum height in pixels.
 * }
 */
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);
}

WordPress Version: 5.4

/**
 * Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.
 *
 * @since 2.9.0
 *
 * @see wp_constrain_dimensions()
 *
 * @param int $example_width  The width of an example embed.
 * @param int $example_height The height of an example embed.
 * @param int $max_width      The maximum allowed width.
 * @param int $max_height     The maximum allowed height.
 * @return int[] {
 *     An array of maximum width and height values.
 *
 *     @type int $0 The maximum width in pixels.
 *     @type int $1 The maximum height in pixels.
 * }
 */
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);
}

WordPress Version: 4.2

/**
 * Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.
 *
 * @since 2.9.0
 *
 * @see wp_constrain_dimensions()
 *
 * @param int $example_width  The width of an example embed.
 * @param int $example_height The height of an example embed.
 * @param int $max_width      The maximum allowed width.
 * @param int $max_height     The maximum allowed height.
 * @return array The maximum possible width and height based on the example ratio.
 */
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);
}

WordPress Version: 4.1

/**
 * Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.
 *
 * @since 2.9.0
 *
 * @param int $example_width The width of an example embed.
 * @param int $example_height The height of an example embed.
 * @param int $max_width The maximum allowed width.
 * @param int $max_height The maximum allowed height.
 * @return array The maximum possible width and height based on the example ratio.
 */
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);
}

WordPress Version: 3.7

/**
 * Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.
 *
 * @since 2.9.0
 * @uses wp_constrain_dimensions() This function passes the widths and the heights.
 *
 * @param int $example_width The width of an example embed.
 * @param int $example_height The height of an example embed.
 * @param int $max_width The maximum allowed width.
 * @param int $max_height The maximum allowed height.
 * @return array The maximum possible width and height based on the example ratio.
 */
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);
}