Rahul, how are the image names related in your system? youll have to conjure some sort of ordering for the pictures before youll be able to tell photo.php the links for the next and previous images, because before you can do that you have to know which pictures actually come next and first in the order of pictures for a specific user. one such ordering might be alphabetical. -nathan On 7/10/07, Rahul Sitaram Johari <sleepwalker@xxxxxxxxxxxxxxxx> wrote:
I¹m trying to write a Photo Gallery in PHP. Everything else is pretty much worked out like thumbnails, indexes, titles & all the one thing I¹m stuck at is the Next & Previous links for the Photos on the main Photo Page. It¹s a simple program where you drop images in a folder and glob() picks up the thumbnails displays them on a page which are automatically linked to the Full Size Images. This is the code: <? $ID = $_GET['ID']; foreach (glob("$ID/thumbnails/*.jpg") as $key=>$value) { $title = rtrim(basename($value),'.jpg'); $newtitle = preg_replace('/_/', ' ', $title); ?> <A HREF="photo.php?photo=<?php echo basename($value); ?>&title=<?php echo $newtitle; ?>&ID=<?php echo $_GET['ID']; ?>&KEY=<?php echo $key; ?>" TARGET="photoFrame"> <IMG SRC="<?php echo $ID; ?>/thumbnails/<?php echo basename($value); ?>"></A> <?php echo $newtitle; ?> <? } ?> I know that $key holds the sequence of images that are being picked up by glob() - I¹m just trying to figure out a way to use this $key to generate the Next & Previous link. The problem is everything is passed on to a separate page (photo.php) ... What I¹m thinking is determining which Photo File would be Next or Previous to the one being selected, and passing that along to the (photo.php) page. I¹m just not able to figure out how to pick out the next & previous filename and place it in the Query String. Any suggestions? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Rahul Sitaram Johari CEO, Twenty Four Seventy Nine Inc. W: http://www.rahulsjohari.com E: sleepwalker@xxxxxxxxxxxxxxxx ³I morti non sono piu soli ... The dead are no longer lonely²