t-kanstantsin / fileupload
文件上传和存储实用工具
v3.10.1
2019-01-04 11:58 UTC
Requires
- php: >=7.1
- guzzlehttp/guzzle: ^6.3.0
- imagine/imagine: ^0.7.1
- league/flysystem: ~1.0
- ralouphie/mimey: ^1.0
Requires (Dev)
- codeception/codeception: ^2.3
- codeception/verify: ~0.3.1
- fzaninotto/faker: 1.5.*
- ps/image-optimizer: ^1.1.2
Suggests
- fortawesome/font-awesome: For file types without preview generator
- ps/image-optimizer: Image optimization toolkit
README
易于控制的文件上传、存储和格式化小部件。
配置
功能齐全的配置示例
<?php use \tkanstantsin\fileupload\FileManager; use \tkanstantsin\fileupload\formatter\Image; use \League\Flysystem\Adapter\Local as LocalFSAdapter; use \League\Flysystem\Filesystem; new FileManager([ 'uploadFS' => new Filesystem(new LocalFSAdapter(__DIR__ . '/tmp/upload', LOCK_EX, LocalFSAdapter::DISALLOW_LINKS)), 'cacheFS' => new Filesystem(new LocalFSAdapter(__DIR__ . '/tmp/web', LOCK_EX, LocalFSAdapter::DISALLOW_LINKS)), 'aliasArray' => [ 'attachment' => [ 'maxCount' => 1, ], ], 'formatterConfigArray' => [ 'attachment-gallery' => [ 'class' => Image::class, 'width' => 1920, 'height' => 1080, 'mode' => Image::RESIZE_INSET, ], 'attachment-preview' => [ 'class' => Image::class, 'width' => 300, 'height' => 150, 'mode' => Image::RESIZE_OUTBOUND, ], ], ]);
别名
name - 别名必须只包含拉丁字母、数字、连字符 (-) 和下划线
class
directory
maxSize
maxCount
multiple
hashMethod
cacheHashLength
filePathClosure
assetNameClosure