intervention/image
http://image.intervention.io/getting_started/introduction
composer require intervention/image
Intervention Image has optional support for Laravel and comes with a Service Provider and Facades for easy integration. The vendor/autoload.php
is included by Laravel, so you don't have to require or autoload manually. Just see the instructions below.
After you have installed Intervention Image, open your Laravel config file config/app.php
and add the following lines.
In the $providers array add the service providers for this package.
Intervention\Image\ImageServiceProvider::class
Add the facade of this package to the $aliases array.
'Image' => Intervention\Image\Facades\Image::class
Now the Image Class will be auto-loaded by Laravel.
By default Intervention Image uses PHP's GD library extension to process all images. If you want to switch to Imagick, you can pull a configuration file into your application by running on of the following artisan command. Publish configuration in Laravel 5
$ php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"
Publish configuration in Laravel 4
$ php artisan config:publish intervention/image
In Laravel 5 applications the configuration file is copied to config/image.php
, in older Laravel 4 applications you will find the file at app/config/packages/intervention/image/config.php
. With this copy you can alter the image driver settings for you application locally.
// usage inside a laravel route
Route::get('/', function()
{
$img = Image::make('foo.jpg')->resize(300, 200);
return $img->response('jpg');
});