当前位置 : 主页 > 编程语言 > 其它开发 >

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

来源:互联网 收集:自由互联 发布时间:2021-08-14
下面由 Laravel 教程栏目给大家介绍Laravel 使用 intervention image 包上传、剪裁图片的方法,希望对需要的朋友有所帮助! 1、通过 composer 安装 composer intervention/image 2、修改 config/app.php 文件,
下面由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包上传、剪裁图片的详细内容,更多请关注自由互联其它相关文章!

网友评论