This package provides an easy to use class to manipulate images. Under the hood it leverages Glide to perform the manipulations.
Here's an example of how the package can be used:
GlideImage::create($pathToImage)
->modify(['w'=> 50, 'filt'=>'greyscale'])
->save($pathToWhereToSaveTheManipulatedImage);
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
You're free to use this package (it's MIT-licensed), but if it makes it to your production environment you are required to send us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.
The best postcards will get published on the open source page on our website.
You can install the package through Composer.
composer require spatie/laravel-glide
You must install this service provider.
// config/app.php
'providers' => [
...
Spatie\Glide\GlideServiceProvider::class,
...
];
This package also comes with a facade, which provides an easy way to generate images.
// config/app.php
'aliases' => [
...
'GlideImage' => Spatie\Glide\GlideImageFacade::class,
...
]
You can publish the config file of the package using artisan.
php artisan vendor:publish --provider="Spatie\Glide\GlideServiceProvider"
The config file looks like this:
<?php
return [
/*
* The driver that will be used to create images. Can be set to gd or imagick.
*/
'driver' => 'gd',
];
Here's a quick example that shows how an image can be modified:
GlideImage::create($pathToImage)
->modify(['w'=> 50, 'filt'=>'greyscale'])
->save($pathToWhereToSaveTheManipulatedImage);
Take a look at Glide's image API to see which parameters you can pass to the modify
-method.
You can run the tests with:
composer test
Previous versions of this package had PHP 5.4 support and the ability to generate images on the fly from an url.
The previous versions are unsupported, but they should still work in your older projects.
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 for more information.