PHP code example of t-kanstantsin / yii2-fileupload
1. Go to this page and download the library: Download t-kanstantsin/yii2-fileupload library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
t-kanstantsin / yii2-fileupload example snippets
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,
],
],
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.