Page 1 of 1

photo album question

Posted: Mon Nov 07, 2005 4:12 am
by augur
i'm currently building a php photo album, and i would like some input from you guys.

first of, let me explai how my script works;
wenn you click on an album, a function will get al the album photo's (path name thumbnail location etc) from the database. then it puts it in an array and loops trough it to get a thumbnail view of al the pictures. wenn you click on a thumbnail, you'll get a largere version of it.
then you've got a next and prev butten(i'm trying to use the Next(), Current(), and Prev() in php).

it works, but i don't like the way i do it. so my question: how would a more expirienced php programmer do this(thumbnail view's and next previous buttons and such)??

Re: photo album question

Posted: Mon Nov 07, 2005 4:52 am
by Chris Corbyn
augur wrote:i'm currently building a php photo album, and i would like some input from you guys.

first of, let me explai how my script works;
wenn you click on an album, a function will get al the album photo's (path name thumbnail location etc) from the database. then it puts it in an array and loops trough it to get a thumbnail view of al the pictures. wenn you click on a thumbnail, you'll get a largere version of it.
then you've got a next and prev butten(i'm trying to use the Next(), Current(), and Prev() in php).

it works, but i don't like the way i do it. so my question: how would a more expirienced php programmer do this(thumbnail view's and next previous buttons and such)??
You'd used the GD library to create thumbnails, either:

a) On-the-fly as requested
b) At the time you insert a record into the DB (my preference)

In terms of your prev(), next() etc.... search these forums for "Pagination"..... it's talked about a lot ;)

Re: photo album question

Posted: Mon Nov 07, 2005 4:11 pm
by John Cartwright
d11wtq wrote:
augur wrote: a) On-the-fly as requested
I prefer this method. I check if the thubnail exists, if so use that thumbnail else: generate it and store it.

Also...

Posted: Wed Nov 30, 2005 1:32 pm
by GRemm
The smallest piece of data in your app is an Image. (contains a path to thumb, path to large, a title/caption, size info.)
The next piece is a Album (a collection of images. Perhaps an iterator pattern could be used for next prev first last)
The last if you wanted to granularize it would be an Gallery (a collection of Albums. Also an iterator)

It always helps to identify the smallest 'grain' of information you need and to identify the collections / containers used to organize them.