- 28.03.13 updated
- What's new
- Requirements
- Install
- Using galleria Behavior
- Binding in widget
- Only widget, without Dataprovider and behaviour etc
- Links
Github repository: Yii-galleria
Based on: EGalleria
28.03.13 updated ¶
update galleria to 1.3.0, minor fixes in widget
What's new ¶
- Upgrade Galleria to version 1.2.8 2012-08-09
- Support Galleria plugins, history plugin enabled by default (but others not tested)
- Support Galleria themes
- Support min.js or not min .js if Yii DEBUG defined, all JS, CSS in one assets folder
- Separate thumbnails and images as option
- Added imagePrefix (behavior), imagePrefixSeparator
- Added srcPrefix and srcPrefixThumb (example use normal image path and thimbnail image path)
Requirements ¶
Tested with Yii 1.1.11, but should work with previous versions too
Install ¶
Extract zip archive to ./webapp/protected/extension/galleria
Add import of galleria extension in your config/main.php file:
'imports'=>array(
...
'application.extensions.galleria.*'
...
),
Using galleria Behavior ¶
Add to image model: ¶
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
),
);
}
Widget: ¶
$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,
)
));
Binding in widget ¶
$photos = new CActiveDataProvider('GalleryPhoto');
$this->widget('Galleria', array(
'dataProvider' => $photos,
'dataProvider' => $data,
'binding' => array(
'image' => 'file_name',
),
));
Only widget, without Dataprovider and behaviour etc ¶
<?php $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();?>
Nice 1
Nice one.thanks for the post.
How to remove image id from URL
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...
image id to the URL
@bit0123, turn off history plugin (enabled by default)
Doubt
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!!
...
Use CActiveRecord or DAO
Doubt
Hi Fad, thanks!
I was able to advance a lot. I added this to my controller:
$criteria=new CDbCriteria; $criteria->compare('cyaId', $id); $photos = new CActiveDataProvider('yachtCYA', array( 'criteria'=>$criteria, ));
And my behavior in my model looks like:
public function behaviors() { return array( 'galleria' => array( 'class' => 'application.extensions.galleria.GalleriaBehavior', 'image' => 'pic1URL' ), ); }
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
redefine the path srcPrefix and srcPrefixThumb
as I change the path to a folder where I have my images, thanks
i need redifine the path folder
'srcPrefix' => '/uploads/gallery/',
'srcPrefixThumb' => '/uploads/gallery/thumb/',
what level folder /uploads/gallery/ ????????
Warning
include(Galleryphoto.php): failed to open stream: No such file or directory
why?
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.