photo album question

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
augur
Forum Newbie
Posts: 5
Joined: Tue Jun 21, 2005 2:33 pm

photo album question

Post 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)??
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: photo album question

Post 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 ;)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: photo album question

Post 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.
GRemm
Forum Newbie
Posts: 17
Joined: Fri Jul 08, 2005 3:37 pm
Location: California
Contact:

Also...

Post 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.
Post Reply