Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hanson/laravel-admin-qiniu
Laravel admin 框架的七牛 qiniu 多图上传扩展
https://github.com/hanson/laravel-admin-qiniu
Last synced: 24 days ago
JSON representation
Laravel admin 框架的七牛 qiniu 多图上传扩展
- Host: GitHub
- URL: https://github.com/hanson/laravel-admin-qiniu
- Owner: Hanson
- License: mit
- Created: 2020-02-09T10:09:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-03-08T03:32:00.000Z (over 4 years ago)
- Last Synced: 2024-08-10T22:56:25.707Z (3 months ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 21
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# laravel-admin-qiniu
Laravel admin 框架的七牛 qiniu 多图上传扩展,可拖拽,异步上传图片,支持删除
![1_7M_G0VFANP6HK48EEL2QO.png](https://i.loli.net/2020/02/09/Hys9IGfjWloc8Fm.png)
![__FP8P8`VX`LN_Y3__4K762.png](https://i.loli.net/2020/02/09/hMFqysDLK4vZaOx.png)
## 安装
`composer require hanson/laravel-admin-qiniu:dev-master -vvv`
## 配置
在 `config/filesystems.php` 增加一个 disk
```php
[
//...
'qiniu' => [
'driver' => 'qiniu',
'access_key' => env('QINIU_ACCESS_KEY', 'xxxxxxxxxxxxxxxx'),
'secret_key' => env('QINIU_SECRET_KEY', 'xxxxxxxxxxxxxxxx'),
'bucket' => env('QINIU_BUCKET', 'xxx'),
'domain' => env('QINIU_DOMAIN', 'xxx.clouddn.com'), // or host: https://xxxx.clouddn.com
],
//...
]
];
```## 使用
```php
qiniuImages('column', '商品图')->sortable(); // 普通用法$form->qiniuImages('column', '商品图')
->sortable() // 让图片可以拖拽排序
->extraData(['disk' => 'qiniu2', 'path' => 'avatar']) // 假如你有多个七牛配置,可以通过指定此处的 disk 进行上传, path 为文件路径的前缀
->value(['http://url.com/a.jpg', 'http://url.com/b.jpg']); // 默认显示的图片数组,必须为 url$form->saving(function (\Encore\Admin\Form $form) {
$paths = \Hanson\LaravelAdminQiniu\Qiniu::getPaths(request('qiniu_column')); // 需要 qiniu_ 作为前缀的字段
});
```