1. Go to this page and download the library: Download dlds/yii2-gallery-manager 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/ */
dlds / yii2-gallery-manager example snippets
class m150318_154933_gallery_ext
extends dlds\galleryManager\migrations\m140930_003227_gallery_manager
{
}
public function actions()
{
return [
'galleryApi' => [
'class' => GalleryManagerAction::className(),
// mappings between type names and model classes (should be the same as in behaviour)
'types => [
'product' => Product::className()
]
],
];
}
if ($model->isNewRecord) {
echo 'Can not upload images for new record';
} else {
echo GalleryManager::widget(
[
'model' => $model,
'behaviorName' => 'galleryBehavior',
'apiRoute' => 'product/galleryApi'
]
);
}
foreach($model->getBehavior('galleryBehavior')->getImages() as $image) {
echo Html::img($image->getUrl('medium'));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.