dev-master
9999999-devImages uploader
MIT
The Requires
- yiisoft/yii2 *
- yiisoft/yii2-bootstrap *
- kartik-v/yii2-widget-fileinput @dev
- imagine/imagine 0.5.*
- yiisoft/yii2-imagine *
by matricks
extension yii2
Images uploader
Uploader, (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
composer require pc-brainy/yii2-uploader "dev-master"
or add, (*4)
"pc-brainy/yii2-uploader" : "dev-master"
to the require section of your application's composer.json
file., (*5)
Add in common/config/main.php 'controllerMap' => [ 'uploader' => 'brainy\uploader\controllers\UploaderController', ],, (*6)
Yii::setAlias('storage', dirname(dirname(DIR)) . '/storage'); Yii::setAlias('images', dirname(dirname(DIR)) . '/storage/images');, (*7)
with default parameters, (*8)
<?php use brainy\uploader\Uploader; echo Uploader::widget(); ?>
with parameters, (*9)
["\brainy\uploader\models\Photo", "image"], 'modal'=>true, 'options' => [ 'multiple' => true, 'accept' => 'image/*', ], 'pluginOptions' => [ 'uploadExtraData'=>[ 'thumbnailSize'=>[320, 200], 'imgFolderPath'=>Yii::getAlias('@images').'/tests', 'multiplePath'=>[ 'full'=>false, 'middle'=>[400, 400], 'thumb'=>[150, 150] ], 'filename'=>$product->name,//product name, description, predefined string, etc 'slug'=>true, 'uniqid'=>true, ], ] ]); ?>
model ["\brainy\uploader\models\Photo", "image"] //[class, attribute] modelul AR in care vor fi salvate informatiile despre imagini slug true/false - convert filename to slugged name converteste denumirea fisierului minuscule-minuscule.ext uniqid true/false - add an uniq ID to filename adauga la numele fisierului un id unic modal = true display a button to launch modal window of uploader thumbnailSize not set of set false = keep actual size [300,200] => [width,height]px 300 => square of 300px uploadUrl set only if will be used your function to upload multiplePath 'multiplePath'=>[ 'folderName'=>false, //save original size 'anotherFolderName'=>[400, 400], //save thumbnails with 400px X 400px 'andAnotherFolderName'=>[150, 150] //save thumbnails with 150px X 150px ....... ], filename a string to be used as filename for saved file dbFields 'dbFields'=>[ 'owner_id'=> $product->id, 'order'=>'999' ] pairs of informations to be saved in model in various field, along filename 'field'=>'value'
Images uploader
MIT
extension yii2