YiiGallery - A Gallery Using Yii

I have removed the demo as it sucks totally. I am rewriting everything from scratch. This time I’ll use the divide and conquer approach.

In the meantime I have created a widget embedding the great PieceMaker 2 Image Rotator by ModularWeb - http://www.modularweb.net/#/en/piecemaker.

The extension page is here - http://www.yiiframework.com/extension/piecemakerwidget/.

My next ‘mission’ is to explore the CContentDecorator class. I think this might be useful for wrapping album/image thumbnails within a ‘sub-view’. And this is definitely a better approach than using renderPartial.

Hey man, I’m interested on this. Could you fix this error “Server Failure: The name server was unable to process this query.” so I can even see it?

Greetings.

This class may be useful to you. I am also building a gallery related application and extended CListView to show the list items (in my case, thumbnails) in a grid view.

I have CSS stuff hard coded into it at this point because it’s just a prototype, but take it if it’s any use to you.




Yii::import('zii.widgets.CListView');


class GalleryView extends CListView

{

        /**

         * @var int the number of columns to render in the table

         * Defaults to 5

         */

        public $cols = 5;


        /**

         * Renders the data item list.

         */

        public function renderItems()

        {

                // hack to override Yii's default of alternating table row colors. Should be moved to a css file with other proper formatting.

                //echo '<style type="text/css">tbody tr:nth-child(even) td, tbody tr.even td {background:#FFF;}</style>';

                echo '<style type="text/css">

                                .GalleryView {background: silver; border-spacing: 2px;}

                                .GalleryView tbody tr td {background: #919AA9;}

                        </style>';


                echo '<table border="0" cellspacing="1" cellpadding="0" width="100%" class="GalleryView">'."\n\t<tr>\n";


                $data=$this->dataProvider->getData();


                if(count($data)>0)

                {

                        $owner=$this->getOwner();

                        $render=$owner instanceof CController ? 'renderPartial' : 'render';


                        $width = (100 / $this->cols).'%';


                        foreach($data as $i=>$item)

                        {

                                $data=$this->viewData;

                                $data['index']=$i;

                                $data['data']=$item;

                                $data['widget']=$this;


                                if($i % $this->cols == 0 && $i != 0)

                                        echo "    </tr>\n    <tr>\n";


                                echo "\t\t<td class='thumb_square' id='thumb_square_$i' width='$width'>\n";

                                        $owner->$render($this->itemView,$data);

                                echo "\n\t\t</td>\n";

                        }

                }

                else

                        $this->renderEmptyText();


                echo "\n\t</tr>\n</table>\n";

        }

}



I was thinking maybe it would be better to derive from CJuiSortable so that images are drag-drop re-organizable. Or maybe try scriptaculous. It does some of the things better than JQuery.

Im have interest on this code… How to use this code…? how to send a gallery id to it…?

i v used it in my project , use it just like CListView :rolleyes: , you should do something different to usual _view.php file, make this file as a album show element :





 <div class="albumDecorator">

           

    <img src="<?php echo $data->zoom_path.'/'.$data->zoom_name.'.s.jpg'; ?>" alt="" image_id='<?php echo $data->id; ?>'>

</div>



hope this help you