2017 © Pedro Peláez
 

yii2-extension yii2-gallery-manager

Port of 'zxbodya/yii-gallery-manager'. Extension for yii2, that allows to manage image galleries.

image

v0lume/yii2-gallery-manager

Port of 'zxbodya/yii-gallery-manager'. Extension for yii2, that allows to manage image galleries.

  • Tuesday, March 3, 2015
  • by v0lume
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

WARNING!!! NOT READY TO USE Yii2 port of https://github.com/zxbodya/yii-gallery-manager, (*1)

Gallery Manager usage instructions

Manual

  1. Checkout source code to your project, for example to ext.galleryManager.
  2. Install and configure image component(https://bitbucket.org/z_bodya/yii-image).
  3. Import gallery models to project, by adding "ext.galleryManager.models.*" to import in config/main.php
  4. Add GalleryController to application or module controllerMap.
  5. Configure and save gallery model, (*2)

    :::php
    $gallery = new Gallery();
    $gallery->name = true;
    $gallery->description = true;
    $gallery->versions = array(
        'small' => array(
            'resize' => array(200, null),
        ),
        'medium' => array(
            'resize' => array(800, null),
        )
    );
    $gallery->save();
  6. Render widget for gallery created above:, (*3)

    :::php
    $this->widget('GalleryManager', array(
        'gallery' => $gallery,
        'controllerRoute' => '/admin/gallery', //route to gallery controller
    ));

Using GalleryBehavior

Using gallery behavior is possible to add gallery to any model in application., (*4)

To use GalleryBehavior:, (*5)

  1. Add it to your model:, (*6)

    Example:
    public function behaviors()
    {
        return array(
            'galleryBehavior' => array(
                'class' => 'GalleryBehavior',
                'idAttribute' => 'gallery_id',
                'versions' => array(
                    'small' => array(
                        'centeredpreview' => array(98, 98),
                    ),
                    'medium' => array(
                        'resize' => array(800, null),
                    )
                ),
                'name' => true,
                'description' => true,
            )
        );
    }
  2. Add gallery widget to your view:, (*7)

    Example:
    <h2>Product galley</h2>
    <?php
    if ($model->galleryBehavior->getGallery() === null) {
        echo '<p>Before add photos to product gallery, you need to save product</p>';
    } else {
        $this->widget('GalleryManager', array(
            'gallery' => $model->galleryBehavior->getGallery(),
        ));
    }
    ?>
  1. Update your model with new versions configuration
  2. Run following code(best place for it - in migration):, (*8)

    :::php
    $models = Model::model()->findAll();
    foreach($models as $model) $model->galleryBehavior->changeConfig();

Note: to run in migration you should define 'webroot' path alias., (*9)

The Versions

03/03 2015

dev-master

9999999-dev

Port of 'zxbodya/yii-gallery-manager'. Extension for yii2, that allows to manage image galleries.

  Sources   Download

BSD-3-Clause

The Requires

 

by Artem Shmanovsky

gallery image

17/12 2014

dev-dev

dev-dev

Extension for yii, that allows to manage image galleries

  Sources   Download

BSD-3-Clause

The Requires

 

by Bogdan Savluk

gallery image