Laravel 使用 intervention image 包上传、剪裁图片

  1. 通过 composer 安装 composer intervention/image

  2. 修改 config/app.php 文件,添加 $providers$aliases
    'Intervention\Image\ImageServiceProvider'

'Image' => 'Intervention\Image\Facades\Image'

  1. 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项目中实现Ajax上传用户头像

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值