Skip to content

Commit

Permalink
Update resizing-images.md (#273)
Browse files Browse the repository at this point in the history
- added use statements to the examples
- fixed Fit::Fit::FillMax typo
  • Loading branch information
makakken authored Aug 22, 2024
1 parent 4e42f7f commit 5741d42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/image-manipulations/resizing-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,19 @@ Resizes the image to fit within the width and height boundaries without cropping

```php
# Example of how to set background colour to fill remaining pixels
use Spatie\Image\Enums\Fit;

$image
->fit(fit: Fit::Fit::FillMax, desiredWidth: 497, desiredHeight: 290, backgroundColor: '#ff5733');
->fit(fit: Fit::FillMax, desiredWidth: 497, desiredHeight: 290, backgroundColor: '#ff5733');
```

![Blue background on fit filled JPG](../../images/example-background.png)

### Example usage

```php
use Spatie\Image\Enums\Fit;

Image::load('example.jpg')
->fit(Fit:Stretch, 450, 150)
->save();
Expand All @@ -99,6 +102,8 @@ The following `CropPosition`s are available on the enum:
### Example usage

```php
use Spatie\Image\Enums\CropPosition;

Image::load('example.jpg')
->crop(250, 250, CropPosition::TopRight)
->save();
Expand Down

0 comments on commit 5741d42

Please sign in to comment.