galleryManager /

Filename Size Date modified Message
47 B
Added tag 1.0.0 for changeset bef1b8417107
3.1 KB
force param for changeConfig in GalleryBehavior
4.1 KB
fix bug in IE8 when it asks to download ajaxUpload
3.0 KB
cleanup, optimised batch photo removal(no it is actually batch - via single request)
216 B
moved photo events handlers to images container, added script to build *.min.js
484 B
fix dependencies
2.8 KB
readme update

Gallery Manager usage instructions


  1. Checkout source code to your project, for example to ext.galleryManager.
  2. Install and configure image component(
  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

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

    $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.

To use GalleryBehavior:

  1. Add it to your model:

    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:

    <h2>Product galley</h2>
    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):

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

Note: to run in migration you should define 'webroot' path alias.