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)??
photo album question
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: photo album question
You'd used the GD library to create thumbnails, either: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)??
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
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: photo album question
I prefer this method. I check if the thubnail exists, if so use that thumbnail else: generate it and store it.d11wtq wrote:augur wrote: a) On-the-fly as requested
Also...
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.
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.