Re: set_display_context_callback() and incorrect pagination

Mike Miller <[email protected]> Tue, 5 Feb 2013 10:02:53 +0200
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAGYq59da_bNCyXhHasCqwa-jrDRbeFaOTWGqmX4tkyyCaOF0tQ@mail.gmail.com>
On Thu, Jan 31, 2013 at 2:40 AM, Bharat Mediratta <[email protected]> wrote:
>   $theme->siblings()
>
> So in thumbnav_block you can do:
>
>   foreach ($theme->siblings() as $sibling) {
>
> and it should just work (I tested it).

I'm now using this, and it works quite well. I added it to
greydragon's paginator, and the information is correct, and the
performance is quite reasonable.

However, I'm having trouble adapting the thumbnav to use this. When I
browse via dynamic/updates, my virtual album has over ten thousand
items, and in order to extract the [9] surrounding images, I currently
search through all items for the first one that matches
$item->rand_key. This is rather slow and often seems to be taking too
much memory; I'm getting PHP crashes in xdebug.so (I haven't debugged
this, but even with smaller albums, it's rather slow).

In the theme's paginator, I don't need to do this, since I have a
$position variable and I only need to extract
$theme->siblings()[$position-something] to [$position+something].

Is there an easier way for me to this from an arbitrary image block,
given just $item?

Thanks

-- Mike

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]