Here's the code:
Code: Select all
<?
include ("/path/to/webroot/header.php");
?>
<script type="text/javascript" src="/js/js/prototype.js"></script>
<script type="text/javascript" src="/js/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="/js/js/lightbox.js"></script>
<link rel="stylesheet" href="/js/css/lightbox.css" type="text/css" media="screen" />
<?
##reads the file named titles
$data=file("titles", FILE_IGNORE_NEW_LINES);
$imgnum=0;
echo "<center>";
##loop through the file line by line
foreach ($data as $line)
{
# #explode the line into two parts separated by a comma
$mparts=explode(',',$line);
# #creates an array out of the line
# #the array contains two unnamed columns - the title of the image, and the caption
$dataarray[$mparts[0]]=$mparts[1];
# #create the HTML to display the images
# #also make sure that lightbox knows this is all one gallery
echo "<a href=\"images/{$mparts[0]}.jpg\" rel=\"lightbox[pastwork]\" title=\"{$mparts[0]}: {$mparts[1]}\"><img border=0 src=\"thumbs/{$mparts[0]}.jpg\"></a>";
echo "\n";
# #increment the imgnum variable
$imgnum += 1;
# #if imgnum is divisible by 3, insert a line break. This creates a page with rows of three images
if (is_int($imgnum / 3)) {
echo "<br>";
}
}
echo "</center>";
include ("/path/to/webroot/footer.php");
?>
Code: Select all
acorn3,a wonderful pipe and knife set
aragorn3,a nice long churchwarden with an ivory shank
author2,a nice hefty pipe with a silver band
rhodesian10,a nice manly rhodesian with a silver band
danish_dublin1,a stout dublin with some danish influence
What you do is simple - create the titles file and populate it according to the format above. Create a folder called images where your full sized images will go, and a directory called thumbs, where your thumbnail images go. Upload these two directories, your titles file, and the script all in the same directory - the specifics of your site will dictate where this is located. Or if you're a rebel like me, use vi to create everything in-situ.
Also, make sure you have the lightbox javascripts on your site in a directory called "js" in your webroot.
A working example can be found here:
http://www.pipecrafter.com/galleries/pastwork/
Questions? Post 'em here. Having been doing this for many, many years, I may have glossed over something incredibly important.