You might want to check my GalleryManager extension first. I will never update this extension again.
This is a Management extension module for a typical jQuery slider,Nivo Slider.It makes possible for an end user to upload images,provide a caption and optionally a link to a page for each image of the slider.The module can easily be modified to manage any widget expecting an array of images as part of it's configuration.Plus,the management page could work very well as an image gallery.
Tested with Yii 1.5,it will probably work with Yii 1.6 also.
'modules'=>array( //...other modules... 'nivoSliderManagement'=>array( 'columnLayout'=> '/layouts/column2', 'upload_directory'=> 'up', 'max_file_number'=> '10', 'max_file_size'=> '1mb', ), //...other modules... );
$this->widget('application.modules.nivoSliderManagement.extensions.nivoslider.CNivoSlider', array( //nsprovider is a variable sent from the corresponding action,see below. 'images'=>$nsprovider, 'effect'=>'sliceUpDown', 'config'=>array( 'effect'=>'sliceUpDown', 'slices'=>25, 'animSpee'=>500, 'pauseTime'=>6000, 'startSlide'=>0, 'directionNav'=>true, 'directionNavHide'=>true, 'controlNav'=>true, 'keyboardNav'=>true, 'pauseOnHover'=>true, 'manualAdvance'=>false, 'captionOpacity'=>0.5, // 'controlNavThumbs'=>true, // 'controlNavThumbsSearch'=>'.jpg', //Replace this with... // 'controlNavThumbsReplace'=>'_100_100_thumb.jpg', //...this in thumb Image src // 'controlNavThumbsFromRel'=>true ) ) );
Yii::import('application.modules.nivoSliderManagement.models.Img'); //get images from database $ns_dataProvider = new CActiveDataProvider('Img', array( 'criteria' => array( 'select' => array('t.path', 't.title', 't.basename', 't.extension','t.url','t.file_id'), 'order' => 'title' ), 'pagination'=>array( 'pageSize'=>50, ), )); $ns_images = $ns_dataProvider->getData(); $nsprovider = array(); $baseurl = Yii::app()->baseUrl; foreach ($ns_images as $image) { if ($image['url'] != "nolink") { $nsprovider[] = array('src' => $image['path'].'/'.$image['file_id'].$image['extension'], 'caption' => $image['title'], 'url' => $baseurl .'/'.$image['url'], 'imageOptions' => array('rel' => $image['path'] .'/tmb/'. $image['file_id'] . '_100_100_thumb' . $image['extension']) ); } else { $nsprovider[] = array('src' => $image['path'] . '/' . $image['file_id'] . $image['extension'], 'caption' => $image['title'], 'imageOptions' => array('rel' => $image['path'] . '/tmb/' . $image['file_id'] . '_100_100_thumb' . $image['extension']) ); } }; $this->render('[VIEW CONTAINING NIVO SLIDER]',array('nsprovider'=>$nsprovider));
The URL for the management page will be [root folder of your Yii application]/nivoSliderManagement.
NOTE:With the exception of cmssitestructuremodule,you don't have to download and install these extensions,they are included in the module's extensions folder.
Cheers.
Total 7 comments
Probably something went wrong with the registration of PlUpload Widget javascript files,make sure they are registered.Could be a problem with the paths in your server.
Hi I am having a problem, i have followed the instructions to the "T" and i get to the paragraph with heading Nivo slider Management Page and the print out bellow:
....the view file containing Nivo Slider.) You can upload up to 10 images at once with PlUpload widget,this can also be configured.
Your browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.
** Manage Uploaded Images** No results found.
But when i go to this -> http://libkal.gr/yii_test/nivoSliderManagement site it works meaning my browser is fine. any ideas??
Thanks for your quick reply. I see now the whole picture. OK - so I'll download and test your extension and see, if this can be easily converted to just a gallery. But I find it so perfect for me, that I think it is worth working around it. Thanks again and cheers.
Hi Trejder, you are not off topic,this gallery is part of the extension,as I state in my overview,if you just want an image gallery and not the Slider management,this extension can still be useful to you:install the module and just modify it,throw away the stuff that deals with the Slider.In resources you can see all the stuff I used,but again,you don't have to download all that,they are all included in my extension.
Hi drumaddict,
This is a bit off topic, but I urge to ask! :) I visted your demo page for this extension and saw there a BEAUTIFUL photo gallery! :) Just exactly like I'm looking for. Can you share information which extension / jQuery plugin / class / library you're using to build these photo galleries, you have there?
Kind regards, Trejder
these operations are ajax calls,I personally use the Firebug console and watch there for any ajax/javascript errors.What do these ajax calls return?
Hi drumaddict,
The extension is cool. The following are the issues that I faced:
Any help would be much appreciated!
PS: Followed your instructions perfectly !
Leave a comment
Please login to leave your comment.