Lightbox + PHPGD = Simple Soultion
Provided by sister company Synapsesinc.comAre you tired of "PHP Galleries" that are "easy" to install, only to leave you with two copies of the image on your server, or requiring you to make a thumbnail image of the picture that can be time consuming and quite litterally a pain. What if, depending on your server of course, could drop images into a folder, and poof, your done. If you have a PHP and GD compliamt webserver, and you want a cool lightbox image gallery, that is easy to update and maintain with the use of ftp, download the latest Synapse Lightbox. Take a peek at the source below. Click here to see it in action and download here
Code Sample (XHTML/CSS)
Type the following code then press Ctrl+S to save the document.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
Synapses Inc. Auto Resize Lightbox Gallery
</title>
<!-- Meta Tags -->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<!-- CSS -->
<link rel="stylesheet" href="staticfiles/css/lightbox.css" type="text/css" media="screen" />
<link rel="stylesheet" href="staticfiles/css/default.css" type="text/css" media="screen" />
<!-- Javascripts -->
<script src="staticfiles/code/scripts/prototype.js" type="text/javascript"></script>
<script src="staticfiles/code/scripts/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="staticfiles/code/scripts/lightbox.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<center><h3>Synapses Inc. Auto Resize Lightbox Gallery</h3></center>
<p> </p>
<ul>
<table align="center" width="600px">
<tr>
<?
// Gallery Directory
$imgdir = 'gallery/';
//Standard Open Directory Call
$dir = opendir($imgdir) or die("Cannot open directory :" . $imgdir);
//Standard Counter
$cntr = 1;
//How many Colums would you like in the display
$cols = "4";
//Now we set a standard width in pixels
$standard_width = "90";
//Now time for the work to get done
while($file = readdir($dir)) // reading the dir
{
if($file <> '.' && $file <> '..')
{
$ext = substr($file, -3);
if(strtolower($ext) == "jpg") {
$size = getimagesize($imgdir ."" . $file);
if($size[0] > $standard_width){ //We will now need to resize the image propely
$calc = $standard_width / $size[0];
$percentage = number_format($calc, 2);
$w = $percentage * $size[0];
$h = $percentage * $size[1];
} else {
$w = $size[0];
$h = $size[1];
}
if($cntr < $cols) {
echo "<td><a href='". $imgdir ."". $file . "' rel='lightbox[gallery]'><img border='0' src='staticfiles/code/imgsize.php?w=". $w ."&h=". $h ."&img=". $imgdir ."". $file ."' /></a><td>";
$cntr++;
} else {
echo "<td><a href='". $imgdir ."". $file ."' rel='lightbox[gallery]'><img border='0' src='staticfiles/code/imgsize.php?w=". $w ."&h=". $h ."&img=". $imgdir ."". $file ."' /></a><td></tr><tr>";
if($cntr == $cols) {
$cntr = 0;
}
$cntr++;
}
}
}
}
?>
</tr>
</table>
<table align="center" width="600px">
<tr>
<td>If you like the scripts, <a href="lightbox.zip">here</a> is a zip copy of the source. Enjoy!<br />
If you use the scripts shoot us an email at This e-mail address is being protected from spambots. You need JavaScript enabled to view it .
</td>
</tr>
</table>
</ul>
</div>
<!--container-->
</body>
</html>


