当前位置

网站首页> 程序设计 > 开源项目 > 程序开发 > 浏览文章

Laravel 使用 intervention image 包上传、剪裁图片 - 互联网之路

作者:小梦 来源: 网络 时间: 2024-07-20 阅读:
  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 fileImage::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上传用户头像

热点阅读

网友最爱