Image manipulation library for Laravel 4 based on Imagine and inspired by Croppa for easy url based manipulation
Open Issues: 1
- php: ^7.2.5|^8.0
- guzzlehttp/guzzle: ^6.3.1|^7.0.1
- illuminate/support: ^7.0|^8.0
- imagine/imagine: ^1.2.4
- fakerphp/faker: ^1.9.1
- mockery/mockery: ^1.3.1
- orchestra/testbench: ^5.0|^6.0
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: ^8.5.8|^9.3.3
This package is auto-updated.
Last update: 2023-03-21 17:00:05 UTC
Laravel Image is an image manipulation package for Laravel 4 and 5 based on the PHP Imagine library. It is inspired by Croppa as it can use specially formatted urls to do the manipulations. It supports basic image manipulations such as resize, crop, rotation, flip and effects such as negative, grayscale, gamma, colorize and blur. You can also define custom filters for greater flexibility. This library works with the local filesystem and Laravel Filesystems (Amazon S3, etc...).
The main difference between this package and other image manipulation libraries is that you can use parameters directly in the url to manipulate the image. A manipulated version of the image is then saved in the same path as the original image, creating a static version of the file and bypassing Laravel for future requests (this behaviour can be disabled).
For example, if you have an image at this URL:
To create a 300x300 version of this image in black and white, you use the URL:
To help you generate the URL to an image, you can use the
Image::url('/uploads/photo.jpg', 300, 300, ['crop', 'grayscale']);
<img src="<?=Image::url('/uploads/photo.jpg', 300, 300, ['crop', 'grayscale']))?>" />
Alternatively, you can programmatically manipulate images using the
Image::make() method. It supports all the same options as the
Image::make('/uploads/photo.jpg', [ 'width' => 300, 'height' => 300, 'grayscale' => true ])->save('/path/to/the/thumbnail.jpg');
or use directly the Imagine library
$thumbnail = Image::open('/uploads/photo.jpg') ->thumbnail(new Imagine\Image\Box(300, 300)); $thumbnail->effects()->grayscale(); $thumbnail->save('/path/to/the/thumbnail.jpg');
Based on Imagine
This package use Imagine for image manipulation. Imagine is compatible with GD2, Imagick, Gmagick and supports a lot of features.
You can define multiple sources for your images. Both locally and in the cloud (via Laravel filesystems).
This package also provides some build-in filters ready to use (more on Filters):
- Crop (with position)
- Black and white
Laravel 7 and up
1- Require the package via Composer.
$ composer require folklore/laravel-image
2- Add the service provider to your
3- Add the facade to your
'Image' => Folklore\Image\Facade::class,
4- Publish the configuration file and public files
$ php artisan vendor:publish --provider="Folklore\Image\ServiceProvider"
5- Review the configuration file at
Here are some features we would like to add in the future. Feel free to collaborate and improve this library.
- Artisan command to manipulate images
- Support for batch operations on multiple files