ianrothmann/laravel-rocket-upload

文件上传的后端处理器。旨在与Rocket Vue App框架的多文件上传功能相辅相成。

0.8.1 2019-07-20 14:41 UTC

This package is auto-updated.

Last update: 2024-09-04 20:43:36 UTC


README

一个使用Rocket Upload Vue组件的Laravel 5文件上传处理器。

安装

composer require ianrothmann/laravel-rocket-upload

config/app.php

服务提供者 IanRothmann\LaravelRocketUpload\ServiceProviders\RocketUploadServiceProvider::class

外观

'RocketUpload' =>IanRothmann\LaravelRocketUpload\Facades\RocketUpload::class

示例

图片示例

return RocketUpload::request($request)
                ->disk('s3') //optional
                ->directory('uploadedfiles')
                ->thumbnail($w,$h,$fit) //$fit=true by default, if false it will resize the picture and not cut off
                ->maxDimensions($w,$h)
                ->processImageWith(function(Image $image){
                     //Intervention Image Object
                     //Do something here
                     return $image;
                  })
                  ->afterUpload(function(File $file){
                     //Do something with file model here
                  })
                ->handle();

文件示例

return RocketUpload::request($request)
                ->disk('s3') //optional
                ->directory('uploadedfiles')
                ->processWith(function($file_contents){
                     //Do something here
                     return $file_contents;
                  })
                ->handle();

小心使用 ->processWith(),它会将整个文件加载到内存中。