Code: Select all
<script type="text/javascript">
window.document.onkeyup = getKey; //set event handler
function getKey(e) {
// Store value of key pressed (cross-browser)
var key = e ? e.which : window.event.keyCode;
if (key == 39){
var arrow = "right";
}
else if (key == 37){
var arrow = "left";
}
alert(arrow);
}
</script>
Code: Select all
<?php
function displayPhotos(){
global $columns,$dir,$album, $max_height, $max_width;
generateThumbnails();
$act = 0;
$keyid = (isset($_GET['keyid']) ? $_GET['keyid']:'0');
$Picturecount = (count(glob("" . $dir . "*.jpg")))/2;
$thumb_selected = (isset($_GET['thumb']) ? $_GET['thumb']:'');
$picture_array = glob("$dir*");
if ($thumb_selected !=""){
//Process file name
$dirName = substr($thumb_selected,0,strpos($thumb_selected,basename($thumb_selected)));
$thumbName = basename($thumb_selected);
$thumbFile = $dirName.$thumbName;
$selected = str_replace('_th.jpg','.jpg',$thumbFile);
foreach ($picture_array as $search){
$keyid = array_search($selected,$picture_array);
$large = $picture_array[$keyid];
}
}
else{
if($keyid > (2*$Picturecount-1)){
$keyid = ($keyid - (2*$Picturecount));
}
if($keyid < 0){
$keyid = (2*$Picturecount+$keyid);
}
$large = $picture_array[$keyid];
}
$picturenumber = ($keyid/2)+1;
echo "<table border='0' width='100%'>
<tr align='right'><td align='left' colspan='2'>$picturenumber of $Picturecount</td></tr>
<tr><td><a href='?album=$album&keyid=" . ($keyid-2) . "'><img src='/gallery/icons/arrow-blue-rounded-left.jpg' alt='Previous'></a></td>";
list($width, $height) = getimagesize($large);
if($width > '550'){
imagejpeg(resizeImage($large,$max_width,$max_height),$large,100);
echo "
<td colspan='3' height='300' width='550' align='center'><a href='?album=$album&keyid=" . ($keyid+2) . "'><img src='$large' alt=''></a></td>";
}
else if($height > '300' && $width < '550'){
echo "
<td colspan='3' height='$height' width='550' align='center'><a href='?album=$album&keyid=" . ($keyid+2) . "'><img src='$large' alt=''></a></td>";
}
else if($height > '300' && $width = '550'){
echo "
<td colspan='3' height='$height' width='550' align='center'><a href='?album=$album&keyid=" . ($keyid+2) . "'><img src='$large' alt=''></a></td>";
}
else{
echo "
<td colspan='3' height='300' width='550' align='center'><a href='?album=$album&keyid=" . ($keyid+2) . "'><img src='$large' alt=''></a></td>";
}
echo "<td><a href='?album=$album&keyid=" . ($keyid+2) . "'><img src='/gallery/icons/arrow-blue-rounded-right.jpg' alt='Next'></a></td></tr><tr><td> </td></tr><tr><td> </td></tr></table><table border='0' align='center' width='90%'>";
?>