<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="thickbox.js"></script>
<link rel="stylesheet" href="thickbox.css" type="text/css" media="screen" />
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php
$columns = 4;
$thmb_width = 150;
$thmb_height = 120;
function resizeImage($originalImage,$toWidth,$toHeight){
// Get the original geometry and calculate scales
list($width, $height) = getimagesize($originalImage);
$xscale=$width/$toWidth;
$yscale=$height/$toHeight;
// Recalculate new size with default ratio
if ($yscale>$xscale){
$new_width = round($width * (1/$yscale));
$new_height = round($height * (1/$yscale));
}
else {
$new_width = round($width * (1/$xscale));
$new_height = round($height * (1/$xscale));
}
// Resize the original image
$imageResized = imagecreatetruecolor($new_width, $new_height);
$imageTmp = imagecreatefromjpeg ($originalImage);
imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
return $imageResized;
}
function generateThumbnails(){
global $thmb_width,$thmb_height;
// Open the actual directory
if ($handle = opendir(".")) {
// Read all file from the actual directory
while ($file = readdir($handle)) {
// Check whether tha actual item is a valid file
if (is_file($file)){
// Check whether the actual image is a thumbnail
if (strpos($file,'_th.jpg')){
$isThumb = true;
} else {
$isThumb = false;
}
if (!$isThumb) {
// Process the file string
$dirName = substr($file,0,strpos($file,basename($file)));
if (strlen($dirName) < 1) $dirName = '.';
$fileName = basename($file);
$fileMain = substr($fileName,0,strrpos($fileName,'.'));
$extName = substr($fileName,strrpos($fileName,'.'),
strlen($fileName)-strrpos($fileName,'.'));
// Check if the actual file is a jpeg image
if (($extName == '.jpg') || ($extName == '.jpeg')||($extName== '.JPG')){
$thmbFile = $dirName.'/'.$fileMain.'_th.jpg';
// If a thumbnail dosn't exists tahn create a new one
if (!file_exists($thmbFile)){
imagejpeg(resizeImage($file,$thmb_width,$thmb_height),$thmbFile,80);
}
}
}
}
}
}
}
function getNormalImage($file){
$base = substr($file,0,strrpos($file,'_th.jpg'));
if (file_exists($base.'.jpg')) return $base.'.jpg';
elseif (file_exists($base.'.jpeg')) return $base.'.jpeg';
else return "";
}
function displayPhotos(){
global $columns;
generateThumbnails();
$act = 0;
// Open the actual directory
if ($handle = opendir(".")) {
// Read all file from the actual directory
while ($file = readdir($handle)) {
// Check whether tha actual item is a valid file
if (is_file($file)){
// Check whether the actual image is a thumbnail
if (strpos($file,'_th.jpg')){
++$act;
if ($act > $columns) {
echo '</tr><tr><td class="photo"><a href="'.getNormalImage($file).'" class="thickbox"><img src="'.$file.'" alt="'.$file.'"/></a></td>';
$act = 1;
} else {
echo '<td class="photo"><a href="'.getNormalImage($file).'"class="thickbox"><img src="><img src="'.$file.'" alt="'.$file.'"/></a></td>';
}
}
}
}
}
}
?>
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000;
}
a:link {
color: #000;
}
a:visited {
color: #000;
}
a:hover {
color: #000;
}
a:active {
color: #000;
}
.Main {
Color:000;
font:Arial, Helvetica, sans-serif;
font-size:12pt;
}
-->
</style></head>
<body bgcolor="#555555" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><Center>
<table width="805" bgcolor="#999999">
<tr><td><center>
<table id="Table_01" width="800" height="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="7">
<img src="../images/banner_01.jpg" width="800" height="164" alt=""></td>
</tr>
<tr>
<td><a href="../index2.html"><img src="../images/Untitled-1_02.jpg" width="100" height="36" border="0" alt=""></a></td>
<td><a href="../models.html"><img src="../images/Untitled-1_03.jpg" width="100" height="36" border="0" alt=""></a></td>
<td><a href="../access.html"><img src="../images/Untitled-1_04.jpg" width="100" height="36" border="0" alt=""></a></td>
<td>
<img src="../images/Untitled-1_05.jpg" width="200" height="36" border="0" alt=""></td>
<td><a href="index.php"><img src="../images/Untitled-1_06.jpg" width="100" height="36" border="0" alt=""></a></td>
<td><a href="../aboutus.html"><img src="../images/Untitled-1_07.jpg" width="100" border="0" height="36" alt=""></a></td>
<td><a href="contact.html"><img src="../images/banner_08.jpg" width="100" border="0" height="36" alt=""></a></td>
</tr>
<tr>
<td colspan="7"> <table align="center"><tr>
<center><b><font size="11pt">Welcome to Our Photo Gallery</font></b></center>
<?php displayPhotos(); ?>
</table>
</td>
</tr>
</table>
</center></td></tr></table>
</Center>
</body>
</html>
when i view source on the page when uploaded it comes up as
<td class="photo"><a href=""class="thickbox"><img src="><img src="boardtrackerrightside_th.jpg" alt="boardtrackerrightside_th.jpg"/></a></td><td class="photo"><a href=""class="thickbox"><img src="><img src="boardtrackerleftside_th.jpg" alt="boardtrackerleftside_th.jpg"/></a></td><td class="photo"><a href=""class="thickbox"><img src="><img src="beachcomberrightside_th.jpg" alt="beachcomberrightside_th.jpg"/></a></td><td class="photo"><a href=""class="thickbox"><img src="><img src="beachcomberleftside_th.jpg" alt="beachcomberleftside_th.jpg"/></a></td>