Github repository: Yii-galleria
Based on: EGalleria
update galleria to 1.3.0, minor fixes in widget
Tested with Yii 1.1.11, but should work with previous versions too
Extract zip archive to ./webapp/protected/extension/galleria
Add import of galleria extension in your config/main.php file:
'imports'=>array( ... 'application.extensions.galleria.*' ... ),
public function behaviors() { return array( 'galleria' => array( 'class' => 'application.extensions.galleria.GalleriaBehavior', 'image' => 'file_name', //required, will be image name of src 'imagePrefix' => 'id',//optional, not required 'description' => 'description',//optional, not required 'title' => 'name',//optional, not required ), ); }
$photos = new CActiveDataProvider('GalleryPhoto'); $this->widget('Galleria', array( 'dataProvider' => $photos, 'imagePrefixSeparator' => '-',//if set 'imagePrefix' => '' in behaviors; separate - imagePrefix{Separator}image 'srcPrefix' => '/uploads/gallery/', 'srcPrefixThumb' => '/uploads/gallery/thumb/', #'themeName' => 'folio',//classic by default #'plugins' => array('history', 'flickr', 'picasa'),//history by default 'options' => array(//galleria options 'transition' => 'fade', #'debug' => true, ) ));
$photos = new CActiveDataProvider('GalleryPhoto'); $this->widget('Galleria', array( 'dataProvider' => $photos, 'dataProvider' => $data, 'binding' => array( 'image' => 'file_name', ), ));
$this->beginWidget('Galleria'); <img src="/uploads/gallery/1.jpg" alt="Description of image" title="Title of image" /> <img src="/uploads/gallery/2.jpg" /> <img src="/uploads/gallery/3.jpg" /> <img src="/uploads/gallery/4.jpg" /> <?php $this->endWidget();
Total 6 comments
Hi Fad, thanks!
I was able to advance a lot. I added this to my controller:
And my behavior in my model looks like:
With this, it brings me pic1URL of the correct ID, what should I add/modify to bring me pic2URL, pic3URL and pic4URL (this are columns of the same table)? I tried with an array but didn't work. Thank you very much Regards, German
Use CActiveRecord or DAO
First of all thanks for this extension. Looks great!
I have the following doubts to implement it:
I need it to display pictures from the same record, implemented as is shows one picture from each record. For example, I have a database table with houses and I want to display pictures from ONE house. I have each picture URL saved in a different column of the house table... is this possible? If yes, how should I approach this?
Thanks in advance!!
@bit0123, turn off history plugin (enabled by default)
Thanks for this easy to use galleria extension.
One problem of this extension is: it shows the image id to the URL. Is there any way to solve this problem?
Any suggestion will be highly appreciable.
Thanks in advance...
Nice one.thanks for the post.
Leave a comment
Please login to leave your comment.