Re: set_display_context_callback() and incorrect pagination

Bharat Mediratta <[email protected]> Tue, 5 Feb 2013 12:55:21 -0800
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAESa+_m_q_r0HRXwf3A--Mb5bj-ThZY2WhYGme99T1F7mLFyog@mail.gmail.com>
Ok, so we need a sliding window of siblings around a fixed point, but the
siblings_callback is returning an iterator over all siblings.  So perhaps
the way to solve this is to extend siblings_callback to handle a limit and
an offset.  Then you can do:

  $theme->siblings($something + 1, $position - $something)

and that'll just iterate over the small set of siblings that you care
about.  How does that sonud?  I can probably get that checked in pretty
quickly if you think that'll work.

-Bharat


On Tue, Feb 5, 2013 at 12:02 AM, Mike Miller <[email protected]> wrote:

> 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 ]