首頁  >  文章  >  php框架  >  Laravel使用intervention image包上傳、剪裁圖片

Laravel使用intervention image包上傳、剪裁圖片

藏色散人
藏色散人轉載
2020-07-29 13:28:335776瀏覽

以下由Laravel教學專欄為大家介紹Laravel 使用 intervention image 套件上傳、剪裁圖片的方法,希望對需要的朋友有所幫助!

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 fmandwing . ##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')

#rrreee#

以上是Laravel使用intervention image包上傳、剪裁圖片的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:segmentfault.com。如有侵權,請聯絡admin@php.cn刪除