Getting Image File Listing Script to work with Lightbox Effect

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hi there,

I've got a php script which searches for images within a certain  
directory and outputs the file listing.  I've edited the echo statement  
so that the images are displayed on the page, and they also open within  
a lightbox image set  
( /).

I'd really apprecate it if someone could help me modify the code below  
so that I can echo the first image so that it has a unique hyperlink,  
then the remaining images to be displayed with a slightly different  
hyperlink.  What I'm trying to do is to echo the first image so that  
only this image displays on the page.  I'd then like to echo the  
remaining images so that these images don't display as images, but  
instead, display within the source code only - this means that the user  
can click the first image (the only image visible on the page) and it  
then opens in a lightbox and they can click next/previous to cycle  
through all the other images.

I know how to do this by hard coding it manually, but don't know how to  
edit the php script to display the first image in a certain format,  
then the remaining images in a different format.

Thanks for any help, and here's the script.



$imgdir = 'testdir/'; // the directory, where images are stored
$allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes  
you want to show
$dimg = opendir($imgdir);
while($imgfile = readdir($dimg))
$a_img[] = $imgfile;
reset ($a_img);
$totimg = count($a_img); // total image number
for($x=0; $x < $totimg; $x++)
echo "<a href=\" /$a_img[$x]\"  
rel=\"lightbox[imagesetgroupname]\" title=\"my caption\"><img  
src=\" /$a_img[$x]\" /></a><br />";

Site Timeline