t-kanstantsin/yii2-fileupload

File upload and store utilities

v1.2 2019-06-26 10:44 UTC

This package is not auto-updated.

Last update: 2022-06-11 16:21:40 UTC


README

Yii2 widget for t-kanstantsin/fileupload

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality Code Coverage Software License

Configuration

Full-featured configuration example:

<?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,
        ],
    ],
]);