|
Posted by comp.lang.php on 10/03/06 15:54
Bob Stearns wrote:
> comp.lang.php wrote:
> > 'll try to explain this as clearly as possible, sorry if it's unclear.
> >
> > You have in your directory /foo 42 images
> >
> > You have in your database metadata for 30 out of those 42 images
> >
> > You have to display all 42 images in the /foo directory whether they
> > have database metadata or not.
> >
> > If any of the 42 images have metadata, you must display the metadata,
> > else, you don't.
> >
> > With me so far? Good, it gets wild from here.
> >
> > You have a requirement for pagination.
> >
> > Your pagination limit is to only show 20 images at a time.
> >
> > The only way I know how to do this is to get all of the images out of
> > the filesystem pertaining to /foo, all of the metadata out of the
> > database pertaining to /foo, and logically combine them (using
> > array_merge()) into a single resultset and display, metadata or not.
> >
> > However, to paginate to the next page, you'll have to have had stuffed
> > THE ENTIRE RESULTSET into a $_SESSION variable and splice that.
> >
> > That of course is not good. But what on earth else do I do? If I am not
> > to use $_SESSION, how would I paginate such an exotic resultset?
> >
> > Thanx
> > Phil
> >
> Just put a hidden variable with the next picture to start with on your
> form. Then after merging the arrays (it might be better to start with an
> array of filenames not the pictures themselves) use the hidden
> variable's value to select which part of the array to display.
I'm sorry I honestly can't follow anything you suggested. I would have
an array of filenames already.
I wound up chucking the entire idea and just merging together an array
of every filename in the filesystem under the album (directory) with a
database table query of all files with metadata where "image_path" is
the name of the album (directory); placing the merged data into a
temporary table and then retrieving that data at one shot using ORDER
BY and LIMIT
Phil
[Back to original message]
|