laravel框架

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

作者:admin 2017-05-09 我要评论( )

通过 composer 安装 composer intervention/image 修改 config/app.php 文件,添加 $providers 和 $aliases'Intervention\Image\ImageServiceProvider' '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');

参考资料

ORM-based file upload package for php. http://codesleeve.com https://github.com/CodeSleeve/stapler

在Laravel项目中实现Ajax上传用户头像

文章来源于segmentfault,原地址:

https://segmentfault.com//a/1190000004216170}

转载请注明出处。

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • laravel-路由篇-01

    2017-05-09

  • MySQL的嵌套事务实现

    2017-05-09

  • 轻量级 PHP 框架 TinyLara 更新:更优雅 附中文介绍

    2017-05-09

  • 深入理解 Laravel Eloquent(二)——中间操作流(Builder)

    2017-05-09