重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
下面由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 5Handling image uploads in Laravel$ php artisan vendor:publish --provider="Intervention\\Image\\ImageServiceProviderLaravel5"
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')