Page 1 of 1
image gallery
Posted: Thu Nov 02, 2006 8:06 am
by sh33p1985
looking at making a basic image gallery, getting the images from a directory and storing them for use is simple enough. though i want to have 4 actions "first", "next", "prev" "last" that the user can click and a new image is displayed. again the code for these actions are simple enough; but how do you actually call these functions from say a <a href="">Next</a>
i thought you might be able to direct to user to image_gallery.php?action=next and catch that and perform the correct action before displaying the correct image.
am i along the right lines?
Posted: Thu Nov 02, 2006 8:12 am
by jayshields
Search: pagination
Posted: Thu Nov 02, 2006 8:17 am
by sh33p1985
pagination wouldnt quite suit what im after imo. i literally would like to display 1 image (first image in directory) with navigation options to allow the user to go to the first image, the previous image, the next image, the last image (in the directory). none of this information will involve a database it will take the directory and put it into an array and these functions will manipulate the pointer within the array.
Posted: Thu Nov 02, 2006 8:39 am
by onion2k
It's still pagination, just with 1 item per page instead of 10, 20, 100, or whatever items. The principle is identical.
Posted: Thu Nov 02, 2006 8:42 am
by sh33p1985
ok ill agree with you there, but doesnt pagination primarily work for data stored in a database?
Posted: Thu Nov 02, 2006 8:45 am
by onion2k
sh33p1985 wrote:ok ill agree with you there, but doesnt pagination primarily work for data stored in a database?
Pagination is simply the act of paging through a list of things. It doesn't matter if they're database records, an array, a glob of files... the code is the same. The only thing that's different is how you make the list in the first place.
Posted: Thu Nov 02, 2006 11:44 am
by bokehman
Hi! My missis wanted a gallery recently and I wrote her a super simple one
which you can look at here. It is one self contained script and there is a second script to admin it. No database! No sessions! No cookies! No Javascript! The admin script makes a thumbnail and resizes the image to a reasonable size. It will even run through a directory on the server that contains multiple images and thumbnail and load them. If you would like the code I can post it.