首页 >php框架 >Laravel > 正文

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

转载2020-07-29 13:29:0004224
下面由Laravel教程栏目给大家介绍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')

以上就是Laravel使用intervention image包上传、剪裁图片的详细内容,更多请关注php中文网其它相关文章!

php中文网最新课程二维码

声明:本文转载于:segmentfault,如有侵犯,请联系admin@php.cn删除

  • 相关标签:Laravel
  • 相关文章

    相关视频


    网友评论

    文明上网理性发言,请遵守 新闻评论服务协议

    我要评论
  • 专题推荐

    作者信息

    藏色散人

    好好学习天天向上!

    最近文章
    jquery是jsp吗309
    jquery中load什么意思758
    jquery ui组件是什么508
    推荐视频教程
  • 全方位解读Laravel框架及实战视频教程全方位解读Laravel框架及实战视频教程
  • Laravel实战开发短链生成器视频教程Laravel实战开发短链生成器视频教程
  • laravel基础开发宝典视频教程laravel基础开发宝典视频教程
  • Laravel电商项目实战课程Laravel电商项目实战课程
  • 视频教程分类