The basic environmental requirements
Environmental requirements:
- PHP >= 5.4
- Fileinfo Extension
- Laravel >=5.0
Expand the package needs:
- GD Library (>=2.0) … or …
- Imagick PHP extension (>=6.5.7)
installation
Prerequisite: you have already installed laravel project, and the current project directory
comoposer mounted intervention / image
php composer.phar require intervention/image
Registration intervention / image in the Laravel
1. Open the config / app.php file
2. 'providers' => [...] The following was added (registered service container)
Intervention\Image\ImageServiceProvider::class
3. 'aliases' => [...] The following was added (Registered facade: [can directly use Image :: make ()]) in
'Image' => Intervention\Image\Facades\Image::class
4.enjoy!
Modify driven imagick (GD default drive - you can not configure)
Excuting an order:
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravelRecent"
Then under your config directory will be more of a image.php
The 'driver' => 'gd' to 'driver' => 'imagick' to
File as follows:
<?php return [ /* |-------------------------------------------------------------------------- | Image Driver |-------------------------------------------------------------------------- | | Intervention Image supports "GD Library" and "Imagick" to process images | internally. You may choose one of them according to your PHP | configuration. By default PHP's "GD Library" implementation is used. | | Supported: "gd", "imagick" | */ 'driver' => 'imagick' ];
Use examples:
// usage inside a laravel route Route::get('/', function() { $img = Image::make('foo.jpg')->resize(300, 200); return $img->response('jpg'); });
Above Reference Intervention / image official website: http://image.intervention.io/getting_started/installation