Package Data | |
---|---|
Maintainer Username: | cuongnhc |
Maintainer Contact: | freek@spatie.be (Freek Van der Herten) |
Package Create Date: | 2015-11-13 |
Package Last Update: | 2015-11-13 |
Home Page: | https://spatie.be/opensource |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-27 15:03:10 |
Package Statistics | |
---|---|
Total Downloads: | 89 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
The package can convert a webpage to an image. To accomplish this conversion Phantomjs (included in the project) is used.
This package is used to generate the sitepreviews on the homepage of spatie.be. It is also used by Gordon Murray to add previews to shared content.
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
This package can be installed through Composer.
composer require secomapp/browsershot
When using Laravel there is a service provider that you can make use of.
// app/config/app.php
'providers' => [
'...',
'Spatie\Browsershot\BrowsershotServiceProvider'
];
Please note that the provided binary is intented for use on Ubuntu.
Here is a sample call to create an image of a webpage:
$browsershot = new Spatie\Browsershot\Browsershot();
$browsershot
->setURL('http://www.arstechnica.com')
->setWidth('1024')
->setHeight('768')
->save('targetdirectory/arstechnica-browsershot.jpg');
These methods are provided:
setBinPath()
: Specify the path to your own phantomjs-binary.setWidth()
: Set the width of the image (defaults to 640).setHeight()
: Set the height of the image (defaults to 480).setHeightToRenderWholePage()
: Calling this method will result in the entire webpage being rendered.setURL()
: Set the URL of the webpage which should be converted to an imagesave($targetFile)
: Starts the conversion-process. The targetfile should have one of these extensions: png, jpg, jpeg.Please see CONTRIBUTING for details.
If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
The MIT License (MIT). Please see License File for more information.