如何获得灯箱图片的标题

I am using a php lightbox (this one - http://www.fatbellyman.com/webstuff/lightbox_gallery/index.php) to automatically display thumbnails and images. I would like to have the titles and image descriptions display on the larger lightbox images, pulled from a separate list (text file?). If it is possible to do this without using a database that would be best.

This is on my gallery page:

<?php include 'lightbox_display_function.php'; ?>
<?php lightbox_display('apparel/soiled/icarus/', 'lightbox[icarus]'); ?>

And this is the lightbox_display_function.php:

<?php function lightbox_display($dir_to_search, $rel){
        $image_dir = $dir_to_search;
        $dir_to_search = scandir($dir_to_search);
        $image_exts = array('gif', 'jpg', 'jpeg', 'png');
        $excluded_filename = '_t';
            foreach ($dir_to_search as $image_file){
            $dot = strrpos($image_file, '.');
            $filename = substr($image_file, 0, $dot);
            $filetype = substr($image_file, $dot+1);
            $thumbnail_file = strrpos($filename, $excluded_filename);
                if ((!$thumbnail_file) and array_search($filetype, $image_exts) !== false){
echo "<a href='".$image_dir.$image_file."' rel='".$rel."'>
<img src='".$image_dir.$filename."_t.".$filetype."' alt='".$filename."' width='70' height='70' title='$filename'/>
</a>"."
";
                }
            }
    }

Do you have some sample code of how you have the page structured at the moment, off the top of my head could you not hard code them into an associative array of some sort?

Have the image file name be the key, so that you can pair up titles with the necessary file?

If you post what you have so far, we could have a look and hopefully make suggestions.

-- Update --

Hardcore the array for the page before you call it, and include the array as a parameter so the elements in it can be paired up with the appropriate images in the function.

<?php include 'lightbox_display_function.php'; ?>
<?php
$titleArray=array();
$titleArray['RedCar.jpg']="Picture of red car";
$titleArray['BlueCar.jpg']="Picture of blue car";
$titleArray['GreenCar.jpg']="Picture of green car";
lightbox_display('apparel/soiled/icarus/', 'lightbox[icarus]',$titleArray); 
?>

So now in the function we have the information to work with

    <?php function lightbox_display($dir_to_search, $rel,$titleArray){
            $image_dir = $dir_to_search;
            $dir_to_search = scandir($dir_to_search);
            $image_exts = array('gif', 'jpg', 'jpeg', 'png');
            $excluded_filename = '_t';
                foreach ($dir_to_search as $image_file){
                $dot = strrpos($image_file, '.');
                $filename = substr($image_file, 0, $dot);
                $filetype = substr($image_file, $dot+1);
                $thumbnail_file = strrpos($filename, $excluded_filename);

                $title="";
                if (array_key_exists($filename, $titleArray)) { //check if the filename matches a key in the array
                   $title = $titleArray[$filename]; //match, so set $title to equal the title set for that image name in the array
                }

                if ((!$thumbnail_file) and array_search($filetype, $image_exts) !== false){
                     //At this point $title can be included in the echo or used in some fashion, put is paired up with the appropriate image.
                     echo "<a href='".$image_dir.$image_file."' rel='".$rel."'>
                     <img src='".$image_dir.$filename."_t.".$filetype."' alt='".$filename."' width='70' height='70' title='$filename'/>
                     </a>"."
";
                    }
                }
        }

I haven't tested that but it should give you something to work with, theory if nothing else.