数码资讯
Laravel 使用 intervention image 包上传、剪裁图片
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
通过 composer 安装
composer intervention/image修改 config/app.php 文件,添加
$providers和$aliases
'InterventionImageImageServiceProvider'
'Image' => 'InterventionImageFacadesImage'
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="InterventionImageImageServiceProviderLaravel5"
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项目中实现Ajax上传用户头像
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。