tiamo / yii2-filesystem
Yii2 filesystem
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Type:yii2-extension
Requires
- league/flysystem: ~1.0
- yiisoft/yii2: *
- yiisoft/yii2-imagine: *
This package is not auto-updated.
Last update: 2024-11-13 07:03:07 UTC
README
Yii2 filesystem
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist tiamo/yii2-filesystem "*"
or add
"tiamo/yii2-filesystem": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
'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' ], ], ],