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: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²

Reply via email to