I have written a simple image gallery scrip witch checks a folder and displays all the images in the folder i have code to remove the . and .. but its not working and I cant see why any help would be great as im new to the dir functions in PHP. I have lightbox tags surrounding the link hence the extra echo's The code is below:
<?
// USER OPTIONS DEDFINED HERE
$dir = "img/"; //folder with images
$height ="196px"; //image height on page its displayed in full in lightbox
$width ="320px"; //image width on page its displayed in full in lightbox
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gallery</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
</head>
<?
//open directory
if ($opendir = opendir($dir));
{
//read dir
while (FALSE !== ($file = readdir($opendir)))
{
if ($file!="."&&$file!="..")
echo "<div class='imgwraper'>";
echo"<a href='$dir$file' rel='lightbox[gallery]' title='$filename'>";
echo "<img src='$dir$file' alt='' width='$width' height='$height'/>";
echo"</a>";
echo "<div class='name_box'>";
echo current(explode('.', $file));
echo "</div>";
echo "</div>";
}
closedir($opendir);
}
?>
Thanks in Advance
Lewis