附件云存储(OSS,COS,七牛,本地存储)

类型 应用插件
版本 1.0.0
版本更新时间 2024-01-22
大小 9.23 KB
开发商
Shopwwi
评分

详细介绍

🆕oss/cos/qiniu/本地文件存储(便捷/批量上传/base64上传/海报-水印-压缩上传)
你可以快速的在插件中下载此插件,下载后你需要对以下进行初始化导入安装

安装

composer require shopwwi/webman-filesystem

支持以下

  • 阿里云 OSS 适配器
composer require shopwwi/filesystem-oss
  • S3 适配器
composer require "league/flysystem-aws-s3-v3:^3.0"
  • 七牛云适配器(php7.X)
composer require "overtrue/flysystem-qiniu:^2.0"
  • 七牛云适配器(php8.X)
composer require "overtrue/flysystem-qiniu:^3.0"
  • 内存适配器
composer require "league/flysystem-memory:^3.0"
  • 腾讯云 COS 适配器(php7.x)
composer require "overtrue/flysystem-cos:^4.0"
  • 腾讯云 COS 适配器(php8.x)
composer require "overtrue/flysystem-cos:^5.0"

使用方法

你可以很方便的使用接口来完成你的文件的上传use plugin\filesystem\api\Storage;引用文件请勿搞错
1.指定上传方式

Storage::adapter('public');

2.快速上传文件

use plugin\filesystem\api\Storage;
$file = $request->file('file');
$result = Storage::upload($file);

3.原文件覆盖 第二参数默认为true即支持同文件上传

use plugin\filesystem\api\Storage;
$file = $request->file('file');
$result = Storage::upload($file,false);

4.更多参数设置

use plugin\filesystem\api\Storage;
$storage = Storage::adapter(public);
$storage->extYes(['image/jpeg','image/gif']); //设置允许上传文件类型
$storage->extNo(['image/png']); //设置禁止上传文件类型
$storage->size(1024*1024*5); // 设置允许上传文件最大容量
$storage->path('storage/upload/user'); //设置文件存放子目录
$storage->uploads($files,10,1024*1024*100); // 多文件上传即批量上传 第二参数限制文件数量 第三参数限制文件总大小
$storage->reUpload($file,$fileName,$ext); // 文件指定名称上传,后缀
$storage->base64Upload($files); //base64上传

// 你还可以使用强大的图片处理器进行预处理 composer require intervention/image 需先安装图片处理sdk
$storage->processUpload($file,function ($image){
                // 图片大小更改 resize()
                $image->resize(100,50)
                // 在图片上增加水印 insert()
                $image->insert('xxx/watermark.png','bottom-right',15,10)
                // 当然你可以使用intervention/image 中的任何功能 最终都会上传在你的storage库中
                return $image
            },$ext);

响应字段

字段 描述 示例值
origin_name 源文件名称 webman.png
file_name 文件路径及名称 storage/a4bab140776e0c1d57cc316266e1ca05.png
storage_key 文件随机key a4bab140776e0c1d57cc316266e1ca05
file_url 文件访问外网 //127.0.0.1:8787/storage/cab473e23b638c2ad2ad58115e28251c.png
size 文件大小 22175
mime_type 文件类型 image/jpeg
extension 文件尾缀 jpg
file_width 图片宽度(图片类型才返回) 206
file_height 图片高度(图片类型才返回) 206

联系方式

你如果在使用中遇到问题 可以联系8988354@qq.com 进行相关售后

版本历史记录
1.0.0
2024-01-21
提供强大的上传模块,支持cos,oss,七牛,本地存储,S3,FTP等更有强大的图片预处理,如水印 海报 压缩等
评分及评论
5 满分5分
yanruistandup 18天前
本地(开放) 本地(私有) 这两个无法保存配置
🔝