[dev] Ansel_Gallery

Chuck Hagenbuch chuck at horde.org
Fri May 18 21:03:54 UTC 2007


Quoting Michael Rubinsky <mike at theupstairsroom.com>:

> I actually did start to go a similar route, but the issue I'm having  
>  is that the HTML I'm referring to is for the gallery and image info  
>  that are displayed on the gallery view...the thumbnails/gallery   
> name/date created/owner etc...
>
> What I started to do is add a method ->getThumbView() that returned   
> the HTML (or  an Ansel_View_Image_Thumb / Ansel_View_Gallery_Thumb   
> object) for  each image/gallery. My idea was that   
> Ansel_Gallery::getThumbView() could also be used from list.php as   
> well.  Anyway, the issue is that it "works", but I'm wondering if  
> the  permormance hit in doing it this way is worth it....The  method  
> would  need to be called for each image/gallery, if we delegate the  
> actual  html generation to a view object - an additional object  
> would be  instantiated for each image/gallery, and if we are  
> allowing comments,  all the the forums/numMessages api call would be  
> called for each image  instead of doing it as a batch for all images  
> at once, like we do now.
>
> The alternative would be to do a is_a() or maybe have getChildren   
> return something like:
>
> Array( Array('type' => 'gallery',
>              'object' => Horde_Gallery object),
>        Array('type' => 'image',
>              'object' => Horde_Image object))

Why not fetch the two things separately in getChildren, do any batch  
fetching for each kind, then return the array of items with their own  
info and the ability to pull the thumb view for them?

If it's a concern, you can have Ansel_Gallery manage instantiating the  
view objects, and set the right data on them with a call...

-chuck


More information about the dev mailing list