Associate
- Joined
- 3 Sep 2003
- Posts
- 1,699
Getting fed up with the bloat required for running a gallery2 set up on my website I have spent a few evenings to come up with this code which browses an album of images, adds each image to a table with the appopriate thumbnail as an image link to lightbox2. Lightbox2 image title is read from the jpegs exif comment tag.
A demo can be seen here:
http://www.brianinnesphotography.co.uk/pages/landscapes.php
Don't try clicking any of the other page links as they aren't up yet. At the moment the page is just a rough test of the code.
If anyone would be kind enough to take a look at the code and check I've not done anything daft (I don't have access to other OS web browsers to check compatibility). Is there a better / easier way to achieve what I want to do?
Thanks in advance.
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!Lightbox2 info>
<script type="text/javascript" src="../js/prototype.js"></script>
<script type="text/javascript" src="../js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="../js/lightbox.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Landscapes</title>
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../css/lightbox.css" type="text/css" media="screen" />
<!--[if lte IE 7]><script src="/include/optionDisabledSupport.js" type="text/javascript"></script><![endif]-->
</head>
<body>
<div id="container"><!-- #BeginLibraryItem "/Library/NavBar.lbi" --><div id="navbarcontainer">
<div id="navbar">
<ul>
<li><a href="/index.php">Home</a></li>
<li><a href="/pages/about.html">About</a></li>
<li><a href="/pages/galleries.php">Galleries</a></li>
</ul>
</div> <!-- navbar -->
</div> <!-- navbarcontainer --><!-- #EndLibraryItem --><div id="portfolio">
<!PHP Table Script>
<div align="center"><center>
<?php
include('../includes/exif.php');
$a = '0';
$filepath = "../albums/landscapes/thumbs";
$url_path = "../albums/landscapes/";
$album_name = "landscapes";
$dir = dir($filepath);
echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"5\" width=\"75%\">";
while($entry=$dir->read()) {
if($entry == "." || $entry == "..") {
continue;
}
$fp = @fopen("$filepath/$entry","r");
if ($a == '0') {echo "<tr>";}
if ($a == '5') {echo "<tr>";}
if ($a == '10') {echo "<tr>";}
if ($a == '15') {echo "<tr>";}
$exifdata = read_exif_data_raw("$url_path/$entry",0);
$caption = $exifdata[IFD0][ImageDescription];
?><td>
<a href="<? echo "$url_path/$entry" ?>"rel ="lightbox[<? echo "$album_name" ?>]" title="<? echo "$caption" ?>">
<img src="<? echo "$filepath/$entry" ?>" alt="<? echo "$caption"?>"></a>
</td>
<?
$a = $a + 1;
}
?>
</tr>
</table>
</center></div>
</body>
</html>
A demo can be seen here:
http://www.brianinnesphotography.co.uk/pages/landscapes.php
Don't try clicking any of the other page links as they aren't up yet. At the moment the page is just a rough test of the code.
If anyone would be kind enough to take a look at the code and check I've not done anything daft (I don't have access to other OS web browsers to check compatibility). Is there a better / easier way to achieve what I want to do?
Thanks in advance.