- 通过 composer 安装
composer intervention/image - 修改 config/app.php 文件,添加
$providers和$aliases
‘Intervention\Image\ImageServiceProvider’
‘Image’ => ‘Intervention\Image\Facades\Image’ - 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”
Handling image uploads in Laravel
In a Laravel application it is also possible to pass an uploaded file directly to the make method.
Creating Image from File Upload in Laravel
// resizing an uploaded file
Image::make(Input::file('photo'))->resize(300, 200)->save('foo.jpg');
参考资料
ORM-based file upload package for php. http://codesleeve.com https://github.com/CodeSleeve/stapler
本文介绍如何在Laravel项目中使用Intervention Image库进行图片处理,包括安装配置、使用上传的文件创建图片实例及调整尺寸等操作。
1073

被折叠的 条评论
为什么被折叠?



