美文网首页Laravel
使用InterventionImage

使用InterventionImage

作者: 加仑子 | 来源:发表于2018-07-09 11:38 被阅读18次

前言

这是个好东西,你会喜欢上它的。

一、环境要求

PHP >= 5.4
Fileinfo Extension

以下两个至少有一个

GD Library (>=2.0)
Imagick PHP extension (>=6.5.7)

可以通过php_info()查看是否符合要求。
如果是按上一篇文章安装的话,这些应该已经准备好了。

二、安装

cd /data/wwwroot/projectDir
composer require intervention/image
composer update
svn add . --no-ignore --force
svn ci

三、在Laravel中进行集成和配置

找到config/app.php文件,在$providers中加一行:

Intervention\Image\ImageServiceProvider::class

再在$aliases中加一行:

'Image' => Intervention\Image\Facades\Image::class

然后

cd /data/wwwroot/projectDir
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"

这时,会在config目录下生成一个image.php文件,修改为

'driver' => 'imagick'

就可以使用了~

相关文章

网友评论

    本文标题:使用InterventionImage

    本文链接:https://www.haomeiwen.com/subject/vxezuftx.html