$dimensions->fitWidth()
Recalculates the width and height to fit the given width
$dimensions->fitWidth(int|null $fit = null, bool $force = false): Kirby\Image\Dimensions
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| $fit | intornull |
null
|
the max width |
| $force | bool |
false
|
If true, the dimensions will be upscaled to fit the box if smaller |
Return type
object with recalculated dimensions
This method modifies the existing $dimensions object it is applied to and returns it again.
Parent class
Examples
$dimensions = new Dimensions(1200, 768);
$dimensions->fitWidth(500);