Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Browsershot v4 #107

Merged
merged 6 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ BrowsershotLambda::html('<h1>Hello world!!</h1>')->saveToS3('example.pdf', 'exam
```

## Image Manipulation
Like the original Browsershot package, you can [manipulate the image](https://spatie.be/docs/browsershot/v2/usage/creating-images#content-sizing-the-image) size and format.
Like the original Browsershot package, you can [manipulate the image](https://spatie.be/docs/browsershot/v4/usage/creating-images#content-sizing-the-image) size and format.

To perform image manipulations on the screenshot, you need to install the optional dependency `spatie/image`. v3 or higher is required.

> **Note**
> If you're using `fit()` in combination with `saveToS3`, the image will be downloaded from S3 to your local disc, manipulated and then uploaded back to S3.
Expand All @@ -128,15 +130,15 @@ Like the original Browsershot package, you can [manipulate the image](https://sp
// Take screenshot at 1920x1080 and scale it down to fit 200x200
BrowsershotLambda::url('https://example.com')
->windowSize(1920, 1080)
->fit(Manipulations::FIT_CONTAIN, 200, 200)
->fit(Spatie\Image\Enums\Fit::Contain, 200, 200)
stefanzweifel marked this conversation as resolved.
Show resolved Hide resolved
->save('example.jpg');

// Take screenshot at 1920x1080 and scale it down to fit 200x200 and save it on S3
// Note: To do the image manipulation, BrowsershotLambda will download the image
// from S3 to the local disc of your app, manipulate it and then upload it back to S3.
BrowsershotLambda::url('https://example.com')
->windowSize(1920, 1080)
->fit(Manipulations::FIT_CONTAIN, 200, 200)
->fit(Spatie\Image\Enums\Fit::Contain, 200, 200)
stefanzweifel marked this conversation as resolved.
Show resolved Hide resolved
->saveToS3('example.jpg');
```

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.2",
"hammerstone/sidecar": "^0.4.0",
"illuminate/contracts": "^8.0|^9.0|^10.0",
"spatie/browsershot": "^3.60",
"spatie/browsershot": "^4.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
Expand Down