Skip to content

Kirby 4.2.0

$dimensions->fit()

Recalculates the width and height to fit into the given box.

$dimensions->fit(int $box, bool $force = false): Kirby\Image\Dimensions

Parameters

Name Type Default Description
$box * int the max width and/or height
$force bool false If true, the dimensions will be
upscaled to fit the box if smaller

Return type

Kirby\Image\Dimensions

This method does not modify the existing $dimensions object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Image\Dimensions