This widget allows to add gallery management with following features:
Gallery manager screenshots:

Few more screenshots: drag & drop upload, editing image information, upload progress,
Example:
// 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), ) ); $gallery->save(); // render widget in view $this->widget('GalleryManager', array( 'gallery' => $gallery, 'controllerRoute' => '/admin/gallery', //route to gallery controller ));
Using gallery behavior is possible to add gallery to any model in application.
To use GalleryBehavior:
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, ) ); }
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(), )); }
Total 19 comments
Excellent extension!. The only missing feature is the possibility to set a image limit.
Seems you need to include twitter bootstrap styles and scripts to your page.
P.S. For such questions, there is forum.
I see js errors on .modal call in js and seems some css not found. Author please update module
I want to use this extension, but can not configured. Is there a detailed example?
By now this is not supported by extension. I know about need in features like this, and may be later, I will modify extension in order to add more flexibility(especially for possibility to have models with different attributes for different gallery type and custom forms to edit them).
For now, you can modify "assets/jquery.galleryManager.js" to fit your needs. To do so, you need:
Great extension! How to add any wysiwyg for photo description area ?
and it's not working wor me...
You can use application controller map. http://www.yiiframework.com/doc/api/1.1/CWebApplication#controllerMap-detail
What is the right controllerMap if I want to use this widget in application but not in the module?
1) check that you have correctly defined the controllerMap. in my case I want the gallery management to be part of the admin module so I wrote:
2)point to the controller in the widget, in my case:
3)check that your web server has write permission on the destination folder for the images
When I use it on my index.php, when I add a image, the message from twitter bootstrap appears: "Edit Information" with save and close buttons, but nothing happens. What can I do?
Great work!
I have fixed this bug few days ago(but forgotten to update extension here)... - the problem was because of difference in html templates on client and server sides.
Photo-select not working. Replace this
to this
Same replace for removeClass('selected'); solves problem.
Each "version" of image is a list of actions what we need to do with original image by Image component in order to get required effects. So if you need contitional resize - you need to add method for that to Image component and use it in your versions configuration.
When I upload small image, extension resize it for all $versions of image.
Need to check for the original size of image, and then resize, if it's larger then in $versions sizes array..
I don't want add this to models, because this will cause errors for all people who do not use tablePrefix(for ex. me).
I think, in next version, I will completely remove bindings to concrete database tables. I want to do this, in order to allow use custom tables for gallery and photo. This is required to add ability for custom photo attributes, and to avoid need in separate table for gallery params in cases when using GalleryBehavior.
Please add support for tablePrefix. I user prefixes and got error when use this manager.
You can not use GalleryManager in controllerMap - it is widget, not controller: use GalleryController.
GalleryController has no index action because it is only for ajax calls from GalleryManager widget.
"Or this extension for use as behavior?" No, you can use it anywhere . There is an example above, how to use it with separate gallery model.
On step 4 I got error:
In my confnig:
ext.galleryManager.GalleryController also got error unable to find the requested action "index".
Or this extension for use as behavior?
Leave a comment
Please login to leave your comment.