andrewdanilov / yii2-input-images
Input images widget
Package info
github.com/AndrewDanilov/yii2-input-images
Type:yii2-extension
pkg:composer/andrewdanilov/yii2-input-images
1.0.7
2026-05-18 22:42 UTC
Requires
- php: >=5.6.0
- andrewdanilov/yii2-fontawesome: ~1.0.0
- mihaildev/yii2-elfinder: *@dev
- yiisoft/yii2: ^2.0.0
README
Widget building form fields for uploading single or multiple images. It extends and requires extension MihailDev/yii2-elfinder
Installation
The preferred way to install this extension is through composer.
Either run
composer require andrewdanilov/yii2-input-images "~1.0.0"
or add
"andrewdanilov/yii2-input-images": "~1.0.0"
to the require section of your composer.json file.
Usage
For use without a file manager
In your config/main.php add:
return [ // ... 'controllerMap' => [ 'uploader' => [ 'class' => 'andrewdanilov\InputImages\UploadController', 'path' => '@frontend/web/upload/post/images', // writable path to upload images to, default is '@webroot/upload/images' 'baseUrl' => '/upload/post/images', // base url to uploaded images, default is '/upload/images' ], ], ];
Then in view just add a widget call:
<?php use andrewdanilov\InputImages\InputImagesSimple; ?> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'logo')->widget(InputImagesSimple::class) ?> <?php ActiveForm::end(); ?>
For use with the file manager
In your config/main.php add:
return [ // ... 'controllerMap' => [ 'elfinder' => [ 'class' => 'mihaildev\elfinder\Controller', 'access' => ['admin'], 'roots' => [ [ 'baseUrl' => '', 'basePath' => '@frontend/web', 'path' => 'upload/images', 'name' => 'Изображения', ], ], ], ], ];
And then add form in your view:
<?php use andrewdanilov\InputImages\InputImages; ?> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'logo')->widget(InputImages::class) ?> <?php ActiveForm::end(); ?>