<html>
<head>
<title><?php
if(!empty($title)){print "$title";}else{print "Image Gallery";}?></title>
</head>
<body>
<?php
$small="small";
$full="large";
// < the folders >
if(empty($dir)){$dir=".";}
if(empty($smalldir)){$smalldir="$dir";}
if(empty($base)){$base="";}
if(empty($par)){$par=" width=100 height=100";}
// < start variables section >
$filetype=array('gif','GIF','bmp','BMP','jpg','jpe','JPG','JPE','png','PNG','JPEG','jpeg');//the accepted formats
$table="table align=center width=600 cellspacing=1 cellpadding=5 border=0 bgcolor=#FFFFFF";
$td="td align=center bgcolor=#222244";
$font="font face=Times";//the font
$clickme="Click on an image for a closer look";//the click message
$previous=" previous image ";//next, previous & back to overview text
$next=" next image ";
// < end variables section >
// << THE SCRIPT >>
if (empty($size)){
$size="$small";
}
$limit=count($filetype);
if ($handle=opendir("$base$dir")){
while (false !==($file=readdir($handle))){
for($i=0;$i<$limit;$i++){
if (strpos($file, $filetype[$i])==false){}else{
$filelist[]="$file";
}}}
closedir($handle);
}
if ($handle2=opendir("$base$smalldir")){
while (false !==($file2=readdir($handle2))){
for($i=0;$i<$limit;$i++){
if (strpos($file2, $filetype[$i])==false){}else{
$smallimage[]="$file2";
}}}
closedir($handle2);
}
sort($filelist);
reset($filelist);
sort($smallimage);
reset($smallimage);
$count=count($filelist);
$count=($count - "1");
print "<$table>";
if(!empty($title)){print "<tr><$td><p class=topic>$title</p></td></tr>";}
print "<tr><$td>\r\n";
if ($size=="$small"){
while (list($arr)=each($filelist)){
print "<a href=\"$PHP_SELF?id=$id&base=$base&size=$full&image=$arr&dir=$dir&smalldir=$smalldir&title=$title&par=$par\"><img$par border=0 src=$base$smalldir/$smallimage[$arr]></a>\r\n";
}}else {
print "<img src=$base$dir/$filelist[$image]>";
}
print "</td></tr><tr><$td>";
if ($size=="$small"){
print "<$font>$clickme</font>";
}
if ($size=="$full"){
if ($image=="0"){
$prevnr="$count";
$nextnr="1";
}
elseif ($image==$count){
$prevnr=($image - "1");
$nextnr="0";
}
else{
$prevnr=($image - "1");
$nextnr=($image + "1");
}
print "<$font><a href=\"$PHP_SELF?id=$id&size=$full&image=$prevnr&dir=$dir&smalldir=$smalldir&title=$title&par=$par\">$previous</a> ";
print "<a href=\"$PHP_SELF?id=$id&size=$full&image=$nextnr&dir=$dir&smalldir=$smalldir&title=$title&par=$par\">$next</a><br><a href=\"$PHP_SELF?id=$id&dir=$dir&par=$par&smalldir=$smalldir&base=$base&title=$title\">Return to thumbnail view</a></font>";
}
print "</tr></td></table>";
?><p align=center><a href="#TOP">TOP</a></p>
</body>
</html>