Skip to content

Kirby 3.9.8

$dimensions->fitWidth()

Recalculates the width and height to fit the given width

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

Parameters

Name Type Default Description
$fit int|null null the max width
$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