tiamo / yii2-filesystem
Yii2 文件系统
v1.0
2015-03-10 20:08 UTC
Requires
- league/flysystem: ~1.0
- yiisoft/yii2: *
- yiisoft/yii2-imagine: *
This package is not auto-updated.
Last update: 2024-09-18 06:14:24 UTC
README
Yii2 文件系统
安装
安装此扩展的首选方式是通过 composer。
运行以下命令
php composer.phar require --prefer-dist tiamo/yii2-filesystem "*"
或者在您的 composer.json
文件的 require 部分添加
"tiamo/yii2-filesystem": "*"
。
使用方法
扩展安装完成后,只需在您的代码中通过以下方式使用即可
'fs' => [ 'class' => 'tiamo\yii2-filesystem\Filesystem', 'formats' => [ '/w([0-9]+)h([0-9]+)/is' => function($w, $h, $path, $file){ if ($file->isImage) { $class = '\yii\imagine\Image'; $class::$driver = [$class::DRIVER_GD2]; $thumbnail = $class::thumbnail($path, $w, $h); return $thumbnail->get($file->extension); } }, ], 'storage' => [ 's1' => [ 'baseUrl' => 'http://s1.site.com', 'adapter' => 'ftp', 'host' => '127.0.0.1', 'root' => 'files' ], ], ],