mrofi / laravel-glide
Easily convert images with Glide (refork from spatie/laravel-glide) But this repo dedicated for php 5.x :). Dont forget to use dev-master
Requires
- php: ^7.0
- illuminate/support: 5.*
- league/glide: ^1.0
Requires (Dev)
- orchestra/testbench: ^3.2
- phpunit/phpunit: 5.*
README
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.
Installation
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', ];
Usage
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.
Testing
You can run the tests with:
composer test
Previous versions
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.
Credits
About Spatie
Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
License
The MIT License (MIT). Please see LICENSE for more information.