Method: size::fit_width

Fits width and height by a passed width and keeps the ratio

Info

Syntax

size::fit_width($width, $height, $fit, $force=false)

Parameters

Return (array)

An array with a key and value for width and height

Example


$new_size = size::fit_width(1200, 768, 500);
// output: array(
//    'width' => 500,
//    'height' => 320
// );

$new_size = size::fit_width(1200, 768, 3000, true);
// output: array(
//    'width' => 3000,
//    'height' => 1920
// );