Skip to content

Commit

Permalink
Update how to fit and fill with a background color.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed May 24, 2024
1 parent b3ddbf6 commit c5a38f8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions docs/image-manipulations/resizing-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ Resizes the image to fit within the width and height boundaries without cropping
# Example of how to set background colour to fill remaining pixels

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

![Blue background on fit filled JPG](../../images/example-background.png)
Expand Down
4 changes: 1 addition & 3 deletions tests/Manipulations/FitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,11 @@
$targetFile = $this->tempDir->path("{$driver->driverName()}/fit-background.png");

$driver->loadFile(getTestJpg())
->fit(Fit::Fill, 2000, 100)
//->background('ff5733')
->fit(fit: Fit::Fill, desiredWidth: 800, desiredHeight: 200, backgroundColor: '#0073ff')
->save($targetFile);

assertMatchesImageSnapshot($targetFile);

//$this->fail('TODO: bug background color is not set');
})->with('drivers');

it('can do fit and crop', function (
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c5a38f8

Please sign in to comment.