<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Image Gallery</title>
<link rel="stylesheet" type="text/css" href="include/photostyle.css" />
<img class='hiddenPic' src='back.png' />
<img class='hiddenPic' src='forward.png' />
<script language="text/javascript">
var img=new Array();
var imgL=new Array();
var imgid=new Array();
var imgEXIF=new Array();
<?php
include 'database.php';
$maxphoto = 0;
$id = $_GET['id'];
$albumid = $_GET['albumid'];
$retid = select_row("SELECT * FROM albums where id = $albumid");
$folder = $retid["folder"];
$albumName = $retid['name'];
$index = 0;
$retid = select("SELECT * FROM photos where albumid = $albumid ORDER BY date");
while ($row = mysql_fetch_array($retid))
{
$exposure = $row['exposure'];
$aperture = $row['aperture'];
$iso = $row['iso'];
$camera = $row['model'];
$lens = $row['lens'];
$focalLength = $row['focalLength'];
if ($row['id'] == $id)
{
$curP = $index;
$startImage = $row['med'];
$startImageL = $row['large'];
$exifBegin = "Exposure: $exposure sec<br />Aperture: $aperture<br />ISO: $iso<br />Camera: $camera<br />Lens: $lens<br />Focal Length: $focalLength";
}
$filename = $row["med"];
$large = $row['large'];
$imageIDC = $row['id'];
echo "img[" . $index . "] = 'albums/" . $folder . "/" . $filename . "';\n";
echo "imgL[" . $index . "] = 'albums/" . $folder . "/" . $large . "';\n";
echo "imgid[$index] = '$imageIDC';\n";
echo "imgEXIF[$index] = 'Exposure: $exposure sec<br />Aperture: $aperture<br />ISO: $iso<br />Camera: $camera<br />Lens: $lens<br />Focal Length: $focalLength';\n";
$index += 1;
$maxPhoto += 1;
}
echo 'var maxPhoto = ' . $maxPhoto . ";\n";
?>
var currentPhoto = <?php echo $curP+1 ?>;
var start = currentPhoto;
window.onload = function() {
document.onselectstart = function() {return false;} // ie
document.onmousedown = function() {return false;} // mozilla
}
function test() {
alert("ajsidf");
}
var loadingIndex = currentPhoto;
function loadNext() {
///alert("maxphoto="+maxPhoto+"start="+start+"loadingindex"+loadingIndex);
loadingIndex = nextPhotoToLoad(1, maxPhoto,start, loadingIndex);
if (loadingIndex != '')
{
document.images['imageLoad'].src = img[loadingIndex-1];
}
}
function movepic(img_name,img_src)
{
if (img_src == 'next' && currentPhoto != maxPhoto)
{
currentPhoto = currentPhoto + 1;
}
if (img_src == 'previous' && currentPhoto != 1)
{
currentPhoto = currentPhoto - 1;
}
document[img_name].src=img[currentPhoto-1];
document.links["largeLink"].href=imgL[currentPhoto-1];
document.links["downloadLink"].href="force-download.php?file="+imgL[currentPhoto-1];
document.links["permalink"].href="photo.php?id="+imgid[currentPhoto-1]+"&albumid=<?php echo "$albumid"; ?>";
document.getElementById('number').innerHTML = currentPhoto+" of "+maxPhoto;
document.getElementById('exifData').innerHTML = imgEXIF[currentPhoto-1];
}
function nextPhotoToLoad(start, end, firstphotonumber, previouslyloadedphotonumber)
{
//alert(Math.abs(previouslyloadedphotonumber - firstphotonumber)*2+firstphotonumber));
if (previouslyloadedphotonumber - firstphotonumber > 0 && ((previouslyloadedphotonumber - firstphotonumber) % 2) == 1 && previouslyloadedphotonumber != end) //loading above and subtraction is odd, load one more forwards
{
return previouslyloadedphotonumber + 1;
}
else if (previouslyloadedphotonumber - firstphotonumber > 0 && firstphotonumber - (previouslyloadedphotonumber - firstphotonumber)/2 > start-1 ) //loading above and loading the next below isnt below start
{
// alert("in here 2");
return firstphotonumber - (previouslyloadedphotonumber - firstphotonumber)/2;
}
else if (previouslyloadedphotonumber - firstphotonumber < 0 && Math.abs(previouslyloadedphotonumber - firstphotonumber)*2+firstphotonumber < end) // loading below and above new-1 is less than end
{
//alert("in here 3");
return Math.abs(previouslyloadedphotonumber - firstphotonumber)*2+firstphotonumber+1;
}
else if (previouslyloadedphotonumber - firstphotonumber < 0 && Math.abs(previouslyloadedphotonumber - firstphotonumber)*2+firstphotonumber <= end && previouslyloadedphotonumber != start)
{
return previouslyloadedphotonumber-1;
}
else if (previouslyloadedphotonumber - firstphotonumber > 0 && firstphotonumber - (previouslyloadedphotonumber - firstphotonumber)/2 <= start-1 && previouslyloadedphotonumber != end)
{
return previouslyloadedphotonumber+1;
}
else if (previouslyloadedphotonumber == firstphotonumber)
{
return firstphotonumber+1;
}
}
function fullscreenLink()
{
var fullscreenURL = "fullscreen.php?id="+imgid[currentPhoto-1]+"&albumid=<?php echo "$albumid"; ?>&height="+document.body.clientHeight+"&width="+document.body.clientWidth;
//alert(fullscreenURL);
window.location.href = fullscreenURL;
}
document.onkeyup=function(e) {
if(e.which == 39)
{
movepic('test','next');
}
if(e.which == 37)
{
movepic('test','previous');
}
}
</script>
<img name="imageLoad" class="hiddenPic" src="<?php echo "albums/$folder/$startImage"; ?>" onload="loadNext()" />
</head>
<body>
<table width="100%" height="100%" align="center">
<tr>
<td valign="middle" width="50px"><img src="back.png" onclick="movepic('test','previous')" name="back" /></td>
<td align="center" valign="middle"><a name="largeLink" href="<?php echo "albums/$folder/$startImageL"; ?>"><img src="<?php echo "albums/$folder/$startImage"; ?>" name="test" border='0' /></a></td>
<td valign="middle" width="50px"><img src="forward.png" onclick="movepic('test','next')" name="forward" /></td>
</tr>
</table>
<div id="backTo"><a href="plist.php?albumid=<?php echo $albumid; ?>">back to <?php echo $albumName; ?></a></div>
<div id="name">
<a href="http://www.sambender.com/">sam bender</a>
</div>
<div id="download">
<a name="permalink" href="photo.php?id=<?php echo "$id"; ?>&albumid=<?php echo "$albumid"; ?>">permalink</a> | <a name="downloadLink" href="force-download.php?file=<?php echo "albums/$folder/$startImageL"; ?>">download</a> | <a href="javascript:fullscreenLink()" name="fullscreen" >fullscreen</a> | <a href="" class="tip">exif<span id="exifData"><?php echo $exifBegin; ?></span></a>
<?php if ($_COOKIE["IsAdmin"] == "yes") { echo " | <a href='javascript:delete()' name='delete' >delete</a>"; } ?>
</div>
<div id="number" name="numbum"><?php echo $curP+1 . " of " . $maxPhoto; ?></div>
</body>
</html>