maks757 / embeddable-gallery
Embeddable gallery, to be attached to any model
Installs: 66
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- kartik-v/yii2-sortable: *
- maks757/yii2-imagable: *
- yiisoft/yii2: >=2.0.4
README
Embeddable gallery, to be attached to any model
backend config
'modules' => [ 'egallery' => [ 'class' => \maks757\egallery\GalleryModule::className() ], //... ],
common config
'components' => [ 'egallery' => [ 'class' => \maks757\imagable\Imagable::className(), 'imageClass' => CreateImageMetaMulti::className(), 'nameClass' => GenerateName::className(), 'imagesPath' => '@frontend/web/images', 'categories' => [ 'category' => [ 'egallery' => [ 'size' => [ 'origin' => [ 'width' => 0, 'height' => 0, ] ] ] ] ] ], //... ],
views
<?php if(!empty($model->id)): ?> <?= $form->field(new \maks757\egallery\components\UploadForm(), 'imageFiles[]')->widget(FileInput::className(), [ 'options' => [ 'multiple' => true, 'accept' => 'image/*' ], 'pluginOptions' => [ 'showRemove' => false, 'previewFileType' => 'image', 'maxFileCount' => 20, 'uploadUrl' => Url::toRoute(['/egallery/image/upload']), 'uploadExtraData' => [ 'id' => $model->id, 'key' => $model->className() ], ], 'pluginEvents' => [ 'fileuploaded' => 'function() { $.pjax.reload({container:"#pjax_block", timeout: 100000, url: "'.Url::to('', true).'"}); }' ] ])->label('Загрузка изображений') ?> <?php Pjax::begin(['enablePushState' => false, 'id' => 'pjax_block']) ?> <?= \maks757\egallery\widgets\show_images\Gallery::widget(['object' => $model, 'show_name' => false]) ?> <?php Pjax::end() ?> <?php endif; ?>