[EXTENSION] fancyBox2 Gallery

Hello all

I was in need of a “popup” gallery function for yii, and quickly found the fancyBox extension - though it turned out that i actually couldn’t get this to work as i wanted to.

So i decided to download the new fancyBox2, and create myself an extension (with the fancybox extension as template) that easily can output a gallery in fancybox…

No more talk.

Download the rar file from: http://www.2shared.com/file/wn3QsSje/fancybox2.html

Unzip to your extension folder.

In your view file:




<a class="open_fancybox"><div class="fancybox-button"></div></a>

<?php $this->widget('application.extensions.fancybox2.EFancyBox2', 

  array(

    'class'=>'open_fancybox', // The class where the fancybox will open from

    'url'=>Yii::app()->request->baseUrl.'/files/'.$galleryFolder->id.'/', // Url to the gallery where all the images are in

    'images'=>$galleryImages, // From the controller, found with "findAll" function.

    'emptyText'=>'bla bla bla', // **Optional

    'config'=>array( // **Optional - look the fancybox2 documentation for more information. http://fancyapps.com/fancybox/#docs

      'helpers'=>array(

        'title'=>array('type'=>'over'), 

        'thumbs'=>array(

          'width'=>100,

          'height'=>100,

          'position'=>'bottom',

        ),

      ),

      'mouseWheel'=>true,

      'arrows'=>true,

      'nextClick'=>true,

      'loop'=>true,

      'openEffect'=>'none',

      'closeEffect'=>'none',

      'prevEffect'=>'fade',

      'nextEffect'=>'fade',

      'padding'=>0,		

    ),

  )

); ?>



And in controller i personally use following:




$galleryFolder=Gallery::model()->findByAttributes(array('merchantId'=>$id));

		

$galleryImages=Galleryimages::model()->findAllByAttributes(array('galleryId'=>$galleryFolder->id));



Gladly write if you got any comments, or something you think should be changed.

But dont flame if you dont like it - just dont use it? :)

// Casper

Could be very useful thing since this extension is supported inactively. But it would be fine to get more usage instructions.

As I understood correctly, images need to be stored in database, not in local directory?

Would be great if you load the project to git. It will be convenient to other developers to support/improve this extension.