国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

基于webman整合的league/flysystem V2/V3版本的本地上傳/cos/oss/qiniu等(新增便捷/批量上傳/base64上傳/海報(bào)-水印-壓縮上傳)

TycoonSong

已上架插件市場(chǎng) 可取插件市場(chǎng) 插件市場(chǎng)

'Build Status' 'Latest Stable Version' 'Total Downloads' 'License'

  • 如果覺(jué)得方便了你,給個(gè)小星星鼓勵(lì)一下吧
  • 如果你遇到問(wèn)題 可以給我發(fā)郵件 8988354@qq.com
  • webman/admin插件版已上線http://www.wtbis.cn/app/view/filesystem

安裝

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"
  • 內(nèi)存適配器
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"

使用

通過(guò)FilesystemFactory::get('local') 來(lái)調(diào)用不同的適配器

    use Shopwwi\WebmanFilesystem\FilesystemFactory;
    public function upload(Request $request)
    {
        $file = $request->file('file');

        $filesystem =  FilesystemFactory::get('local');
        $stream = fopen($file->getRealPath(), 'r+');
        $filesystem->writeStream(
            'uploads/'.$file->getUploadName(),
            $stream
        );
        fclose($stream);

        // Write Files
        $filesystem->write('path/to/file.txt', 'contents');

        // Add local file
        $stream = fopen('local/path/to/file.txt', 'r+');
        $result = $filesystem->writeStream('path/to/file.txt', $stream);
        if (is_resource($stream)) {
            fclose($stream);
        }

        // Update Files
        $filesystem->update('path/to/file.txt', 'new contents');

        // Check if a file exists
        $exists = $filesystem->has('path/to/file.txt');

        // Read Files
        $contents = $filesystem->read('path/to/file.txt');

        // Delete Files
        $filesystem->delete('path/to/file.txt');

        // Rename Files
        $filesystem->rename('filename.txt', 'newname.txt');

        // Copy Files
        $filesystem->copy('filename.txt', 'duplicate.txt');

        // list the contents
        $filesystem->listContents('path', false);
    }

便捷式上傳

  • 支持base64圖片上傳
  • 支持設(shè)定重復(fù)文件上傳及文件覆蓋
  • 支持指定文件名上傳及文件覆蓋
  • 新增圖片處理器上傳 (附加于強(qiáng)大的海報(bào)生成/圖片壓縮/水印等)
  • 
    use Shopwwi\WebmanFilesystem\Facade\Storage;
    public function upload(\support\Request $request){
         // 適配器 local默認(rèn)是存儲(chǔ)在runtime目錄下 public默認(rèn)是存儲(chǔ)在public目錄下
         // 可訪問(wèn)的靜態(tài)文件建議public
         // 默認(rèn)適配器是local
         Storage::adapter('public');
        //單文件上傳
        $file = $request->file('file');
        // 上傳第二參數(shù)默認(rèn)為true即允許相同文件的上傳 為false時(shí)將會(huì)覆蓋原文件
        $result = Storage::upload($file,false);
        //單文件判斷
        try {
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->upload($file);
         }catch (\Exception $e){
            $e->getMessage();
         }
    
         //多文件上傳
         $files = $request->file();
         $result = Storage::uploads($files);
         try {
         //uploads 第二個(gè)參數(shù)為限制文件數(shù)量 比如設(shè)置為10 則只允許上傳10個(gè)文件 第三個(gè)參數(shù)為允許上傳總大小 則本列表中文件總大小不得超過(guò)設(shè)定 第四參數(shù)默認(rèn)為true即允許同文件上傳 false則為覆蓋同文件
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->uploads($files,10,1024*1024*100);
         }catch (\Exception $e){
            $e->getMessage();
         }
    
        // 指定文件名上傳(同文件將被覆蓋)
        try {
            $files = $request->file();
            $fileName = 'storage/upload/user/1.png'; // 文件名中如此帶了路徑 則下面的path無(wú)效 未帶路徑1.png效果相等
            $ext = true; // 文件尾綴是否替換 開(kāi)啟后則$files上傳的任意圖片 都會(huì)轉(zhuǎn)換為$fileName尾綴(示例: .png),默認(rèn)false
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->reUpload($file,$fileName,$ext);
         }catch (\Exception $e){
            $e->getMessage();
         }
    
        // base64圖片上傳
        try {
            $files = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCCAYAAAB8GMlFAAAAAXNSR0IArs4c6QAAAARnQU1BAACx...";
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->base64Upload($files);
         }catch (\Exception $e){
            $e->getMessage();
         }
    
        // 強(qiáng)大的圖片處理 你甚至可以創(chuàng)建畫(huà)報(bào)直接保存
        // 在使用前 請(qǐng)確保你安裝了 composer require intervention/image
        try {
            $files = $request->file();
            $fileName = 'storage/upload/user/1.png'; // 文件名中如此帶了路徑 則下面的path無(wú)效 未帶路徑1.png效果相等
            $ext = true; // 文件尾綴是否替換 開(kāi)啟后則$files上傳的任意圖片 都會(huì)轉(zhuǎn)換為$fileName尾綴(示例: .png),默認(rèn)false
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->processUpload($file,function ($image){
                // 圖片大小更改 resize()
                $image->resize(100,50)
                // 在圖片上增加水印 insert()
                $image->insert('xxx/watermark.png','bottom-right',15,10)
                // 當(dāng)然你可以使用intervention/image 中的任何功能 最終都會(huì)上傳在你的storage庫(kù)中
                return $image
            },$ext);
         }catch (\Exception $e){
            $e->getMessage();
         }
    
         //獲取文件外網(wǎng)
         $filesName = 'storage/a4bab140776e0c1d57cc316266e1ca05.png';
         $fileUrl = Storage::url($filesName);
         //指定選定器外網(wǎng)
         $fileUrl = Storage::adapter('oss')->url($filesName);
    }


### 靜態(tài)方法(可單獨(dú)設(shè)定)

| 方法      | 描述            | 默認(rèn)                 |
|---------|---------------|--------------------|
| adapter | 選定器           | config中配置的default  | 
| size    | 單文件大小         | config中配置的max_size |
| extYes  | 允許上傳文件類型      | config中配置的ext_yes  |
| extNo   | 不允許上傳文件類型     | config中配置的ext_no   |
| path    | 文件存放路徑(非完整路徑) | storage            |

### 響應(yīng)字段

| 字段          |     描述           |  示例值                                                          |
|-------------|---------------|---------------------------------------------------------------|
| origin_name | 源文件名稱         | webman.png                                                    |
| file_name   | 文件路徑及名稱       | storage/a4bab140776e0c1d57cc316266e1ca05.png                  |
| storage_key | 文件隨機(jī)key       | a4bab140776e0c1d57cc316266e1ca05                              |
| file_url    | 文件訪問(wèn)外網(wǎng)        | //127.0.0.1:8787/storage/cab473e23b638c2ad2ad58115e28251c.png |
| size        | 文件大小          | 22175                                                         |
| mime_type   | 文件類型          | image/jpeg                                                    |
| extension   | 文件尾綴          | jpg                                                           |
| width       | 圖片寬度(圖片類型才返回) | 206                                                           |
| height      | 圖片高度(圖片類型才返回)        | 206                                                           |
7369 12 4
12個(gè)評(píng)論

walkor

感謝分享

  • 暫無(wú)評(píng)論
TycoonSong

新增便捷快速批量上傳

便捷式上傳

    use Shopwwi\WebmanFilesystem\Facade\Storage;
    public function upload(\support\Request $request){
        //單文件上傳
        $file = $request->file('file');
        $result = Storage::upload($file);
        //單文件判斷
        try {
            $result = Storage::adapter('local')->path('upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->upload($file);
         }catch (\Exception $e){
            $e->getMessage();
         }

         //多文件上傳
         $files = $request->file();
         $result = Storage::uploads($files);
         try {
         //uploads 第二個(gè)參數(shù)為限制文件數(shù)量 比如設(shè)置為10 則只允許上傳10個(gè)文件 第三個(gè)參數(shù)為允許上傳總大小 則本列表中文件總大小不得超過(guò)設(shè)定
            $result = Storage::adapter('local')->path('upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->uploads($files,10,1024*1024*100);
         }catch (\Exception $e){
            $e->getMessage();
         }

         //獲取文件外網(wǎng)
         $filesName = 'storage/a4bab140776e0c1d57cc316266e1ca05.png';
         $fileUrl = Storage::url($filesName);
         //指定選定器外網(wǎng)
         $fileUrl = Storage::adapter('oss')->url($filesName);
    }

靜態(tài)方法(可單獨(dú)設(shè)定)

方法 描述 默認(rèn)
adapter 選定器 config中配置的default
size 單文件大小 config中配置的max_size
extYes 允許上傳文件類型 config中配置的ext_yes
extNo 不允許上傳文件類型 config中配置的ext_no
path 文件存放路徑(非完整路徑) storage

響應(yīng)字段

字段 描述 示例值
origin_name 源文件名稱 webman.png
file_name 文件路徑及名稱 storage/a4bab140776e0c1d57cc316266e1ca05.png
storage_key 文件隨機(jī)key a4bab140776e0c1d57cc316266e1ca05
file_url 文件訪問(wèn)外網(wǎng) //127.0.0.1:8787/storage/cab473e23b638c2ad2ad58115e28251c.png
size 文件大小 22175
mime_type 文件類型 image/jpeg
extension 文件尾綴 jpg
width 圖片寬度(圖片類型才返回) 206
height 圖片高度(圖片類型才返回) 206
  • 暫無(wú)評(píng)論
嘿嘿
"php": ">=8.1",

2022-04-05 12:43:59 pid:1 Worker process terminated with ERROR: E_ERROR "During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Qiniu\Http\Header::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php:114

Stack trace:

0 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php(8): {closure}(8192, 'Return type of ...', 'D:\laragon\www\...', 114)

1 D:\laragon\www\dev\vendor\composer\ClassLoader.php(571): include('D:\laragon\www\...')

2 D:\laragon\www\dev\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('D:\laragon\www\...')

3 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Client.php(128): Composer\Autoload\ClassLoader->loadClass('Qiniu\Http\Head...')

4 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Client.php(13): Qiniu\Http\Client::sendRequest(Object(Qiniu\Http\Request))

5 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Region.php(147): Qiniu\Http\Client::get('api.qiniu.com/v...')

6 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Zone.php(45): Qiniu\Region::queryRegion('qxM_haL4C7EoaG_...', 'woisks')

7 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Config.php(135): Qiniu\Zone::queryZone('qxM_haL4C7EoaG_...', 'woisks')

8 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Config.php(41): Qiniu\Config->getRegion('qxM_haL4C7EoaG_...', 'woisks')

9 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Storage\FormUploader.php(61): Qiniu\Config->getUpHost('qxM_haL4C7EoaG_...', 'woisks')

10 D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Storage\UploadManager.php(116): Qiniu\Storage\FormUploader::put('qxM_haL4C7EoaG_...', 'avatar', '\xFF\xD8\xFF\xE0\x00\x10JFIF\x00\x01\x01\x00\x00...', Object(Qiniu\Config), NULL, 'application/oct...', 'wor9AC9.tmp')

11 D:\laragon\www\dev\app\passport\controller\State.php(42): Qiniu\Storage\UploadManager->putFile('qxM_haL4C7EoaG_...', 'avatar', Object(Webman\Http\UploadFile))

12 D:\laragon\www\dev\framework-webman\App.php(331): app\passport\controller\State->online(Object(Webman\Http\Request))

13 D:\laragon\www\dev\framework-webman\App.php(146): Webman\App::findRoute(Object(Workerman\Connection\TcpConnection), '/passport/onlin...', 'POST/passport/o...', Object(Webman\Http\Request))

14 D:\laragon\www\dev\vendor\workerman\workerman\Connection\TcpConnection.php(638): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(Webman\Http\Request))

15 D:\laragon\www\dev\vendor\workerman\workerman\Events\Select.php(295): Workerman\Connection\TcpConnection->baseRead(Resource id #196)

16 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(2431): Workerman\Events\Select->loop()

17 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(1430): Workerman\Worker->run()

18 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(1373): Workerman\Worker::forkWorkersForWindows()

19 D:\laragon\www\dev\vendor\workerman\workerman\Worker.php(549): Workerman\Worker::forkWorkers()

20 D:\laragon\www\dev\start.php(94): Workerman\Worker::runAll()

21 {main} in D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php on line 8"

2022-04-05 12:44:00 pid:1 Worker process terminated with ERROR: E_ERROR "During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Qiniu\Http\Header::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\laragon\www\dev\vendor\qiniu\php-sdk\src\Qiniu\Http\Header.php:114

  • 嘿嘿 2022-04-05

    七牛云上傳失敗 的信息

  • TycoonSong 2022-04-08

    如果需支持8.0的選定器需安裝composer require "overtrue/flysystem-qiniu:^3.0"

伯符

便捷式上傳報(bào)錯(cuò)
指定適配器時(shí)
$path = Storage::adapter('qiniu')->path($storePath)->upload($image);
Undefined array key \"qiniu\
截圖
默認(rèn)適配器時(shí)
截圖
截圖

  • TycoonSong 2022-09-23

    config的配置里有個(gè)url是需要填寫的

doit

Could not find a matching version of package shopwwi/flysystem-oss. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
請(qǐng)問(wèn)這是composer源的問(wèn)題嗎?

  • TycoonSong 2022-10-01

    composer require shopwwi/filesystem-oss 用這個(gè)

yysu

OSS 會(huì)報(bào)
PositionNotEqualToLength: Position is not equal to file length RequestId

doit

截圖
應(yīng)為$this-config['max_size'],否則配置文件max_size不生效

sanye

最新版本的webman安裝總是失敗
安裝信息如下:
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]?
./composer.json has been updated
Running composer update overtrue/flysystem-qiniu
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1

  • league/mime-type-detection[1.0.0, ..., 1.11.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
  • overtrue/flysystem-qiniu[2.0.0, ..., 2.0.1] require league/flysystem ^2.0 -> satisfiable by league/flysystem[2.0.0, ..., 2.5.0].
  • league/flysystem[2.0.0, ..., 2.5.0] require league/mime-type-detection ^1.0.0 -> satisfiable by league/mime-type-detection[1.0.0, ..., 1.11.0].
  • Root composer.json requires overtrue/flysystem-qiniu ^2.0 -> satisfiable by overtrue/flysystem-qiniu[2.0.0, 2.0.1].

To enable extensions, verify that they are enabled in your .ini files:

  • /www/server/php/74/etc/php-cli.ini
    You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.
    Alternatively, you can run Composer with --ignore-platform-req=ext-fileinfo to temporarily ignore these required extensions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

  • TycoonSong 2023-01-05

    看提示好像是說(shuō)你的league/flysystem版本不對(duì) 看看是否安裝到3.x了 現(xiàn)在默認(rèn)都是php8以上版本了

  • keytehu 2023-01-05

    require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.

    英語(yǔ)都還給老師了?明顯說(shuō)的是系統(tǒng)缺少fileinfo擴(kuò)展。

  • TycoonSong 2023-01-05

    英語(yǔ)確實(shí)不太好 ??

water2023

給力~

  • 暫無(wú)評(píng)論
龍正哲

你好,請(qǐng)問(wèn)這個(gè)支持直接連接 minio上傳不?

  • 暫無(wú)評(píng)論
軟飯工程師

你好,請(qǐng)問(wèn)如何驗(yàn)證word、pdf、xlsx、wav、mp4,等等,希望支持驗(yàn)證更多的文件類型

  • 暫無(wú)評(píng)論
TycoonSong

新增了個(gè)圖片處理上傳接口 歡迎大家使用

  • 暫無(wú)評(píng)論
年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表評(píng)論

TycoonSong

1204
積分
0
獲贊數(shù)
0
粉絲數(shù)
2021-10-29 加入
??