oxy-coach/yii2-images-upload-widget
Composer 安装命令:
composer require oxy-coach/yii2-images-upload-widget
包简介
Images upload widget working with yii2 image behavior
README 文档
README
Images upload widget working with ImageBehavior with sorting and deleting images via ajax.
Installation via Composer
Run the following command
$ composer require oxy-coach/yii2-images-upload-widget "*"
or add
$ "oxy-coach/yii2-images-upload-widget": "*"
to the require section of your composer.json file.
Configuring
Add action in the controller, for example:
use oxycoach\imageswidget\SortImagesAction; use oxycoach\imageswidget\DeleteImagesAction; \\ ... public function actions() { return [ 'sort-images' => [ 'class' => SortImagesAction::class, 'modelName' => MyModel::class, ], 'delete-image' => [ 'class' => DeleteImagesAction::class, 'modelName' => MyModel::class, ], ]; }
Usage
use oxycoach\imageswidget\ImagesUploadWidget; <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> \\ ... <?= ImagesUploadWidget::widget([ 'form' => $form, 'model' => $model, 'name' => 'files', 'multiple' => true, 'size' => 'preview', 'sortAction' => ['sort-images'], 'deleteAction' => ['delete-image'], ]) ?>
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| name | string | model images property name | |
| sortAction | array | ['sort-images'] |
route for image sorting url |
| deleteAction | array | ['delete-image'] |
route for delete image url |
| multiple | boolean | false |
flag for multiple images field |
| size | string | 'preview' |
displaying images size - for more information checkout ImageBehavior |
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2018-08-21