Posts Learn Components Snippets Categories Tags Tools About

How to Save Screenshot from Browsershot

Get to know how to Save Screenshot from Browsershot package by spatie and then save it to S3 Disk or any of the disk you are currently using

Created on Jan 25, 2022


To save a screenshot from the Browsershot package that's other than the local file you can call the "screenshot()" method at the end which then will return the file that can be saved into a disk such as "s3" or other object storage such as "vultr" and "digital ocean".

use Illuminate\Support\Facades\Storage;

$screenshot = Browsershot::url('url-to-screenshot')
            ->setOption('viewport.deviceScaleFactor', 1)

Storage::disk('s3')->put('image.png', $screenshot, 'public');
By doing so you can specify any of the other disk types other than saving it to the storage directory. Do give it a try first and cheers! Happy coding.

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for How to Save Screenshot from Browsershot


PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Sponsors 👑

+ Add Yours