标签:col info drive make started intern san nal tis
环境需求:
拓展包需求:
前提:你已经安装好laravel 项目,且当前在项目目录
php composer.phar require intervention/image
1.打开 config/app.php 文件
2.在 ‘providers‘ =>[...] 添加以下(容器服务注册)
Intervention\Image\ImageServiceProvider::class
‘Image‘ => Intervention\Image\Facades\Image::class
4.enjoy!
执行命令:
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravelRecent"
这时你的config目录下会多出一个image.php
将 ‘driver‘ => ‘gd‘ 改为 ‘driver‘ => ‘imagick‘ 即可
文件如下:
<?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‘ ];
// usage inside a laravel route Route::get(‘/‘, function() { $img = Image::make(‘foo.jpg‘)->resize(300, 200); return $img->response(‘jpg‘); });
以上内容参考 Intervention/image 官网:http://image.intervention.io/getting_started/installation
Laravel 使用 Intervention/image 配置和修改驱动 imagick
标签:col info drive make started intern san nal tis
原文地址:https://www.cnblogs.com/zjhblogs/p/12170594.html