// This Script is made by Martin Kollaard (www.nfshome.com) and modified by Jeroen Bruurs (www.nd4spdworld.com)
//
// How does it work?
// Change the variables below
// name of the page
$page_title = "Foto's";
// where is the page located? for example "http://www.yourdomain.com/pictures/"
$homeurl = "";
// Now upload it to your server and create a dir called 'thumbnails'
// for example: yourfotodirectory/thumbnails/
// now chmod this directory with the permission of 777
// open the index.php file (do NOT rename it)
// This script opens .jpg files only!
// do not edit anything below this line.
// Omdat we registered globals niet aan willen hebben,
// halen we de GET variabelen gewoon even uit de array:
$nr = $_GET["nr"];
?>
echo $page_title ?>
$pic_pagelimit = "20";
$pic_rijlimit = "5";
if ($version == "") { $version = 6; }
$sitetitle = $page_title;
?>
if ($pic) {
echo "
Go back";
} else {
?>
$dir = opendir(".");
while($file=readdir($dir)){
if(!eregi("^(.|..)$",$file)){
$fullfile = $file;
$ext = strtolower(substr(strrchr($file, "."), 1));
if (filetype($fullfile) == "file" && $fullfile != "index.php" && $ext == "jpg") {
$total++;
$time = filemtime($fullfile);
$data[$total] = "$time $file";
}
}
}
ksort($data);
$pages = $total / $pic_pagelimit;
$pages = ceil($pages);
if ($nr == "") {
// paginanummer...
$nr = "1";
}
$end = $pic_pagelimit*$nr+1;
$start = $end-$pic_pagelimit;
while(list($key,$val) = each($data)) {
$num++;
if ($num == $end) { break; }
if ($num >= $start) {
$pic = explode(" ", $val);
if ($newrij == $pic_rijlimit) { echo "
"; $newrij = 0; }
$newrij++;
$pic = "$pic[1]";
$size = GetImageSize ($pic);
$width = $size[0];
$height = $size[1];
if ($height == $width) {
$height = "150";
$width = "150";
} elseif ($width < $height) {
$size = GetImageSize ("$pic");
$max = 150;
$verhouding = $width / $height;
$height = $max;
$width = $max * $verhouding;
} elseif ($width > $height) {
$size = GetImageSize ("$pic");
$max = 150;
$verhouding = $height / $width;
$width = $max;
$height = $max * $verhouding;
}
if (!file_exists($filepath[screenshots]["$version"] . "thumbnails/" . $pic)) {
imageresize($pic, "thumbnails/" . $pic, 150);
}
echo " | ";
}
}
?>
$nextpage = $nr+1;
$backpage = $nr-1;
if ($nr <= "1") { echo " < Back "; } else { echo " < Back "; }
$printnr = 0;
while ($pages > $printnr) {
$printnr++;
echo " $printnr";
}
if ($nr >= $pages) { echo " Next > "; } else { echo " Next > "; }
}
?>
function my_filesize($file) {
$kb = 1024; // Kilobyte
$mb = 1024 * $kb; // Megabyte
$gb = 1024 * $mb; // Gigabyte
$tb = 1024 * $gb; // Terabyte
// Get the file size in bytes.
$size = filesize($file);
if($size < $kb) {
return $size." Bytes";
}
else if($size < $mb) {
return round($size/$kb,2)." KB";
}
else if($size < $gb) {
return round($size/$mb,2)." MB";
}
else if($size < $tb) {
return round($size/$gb,2)." GB";
}
else {
return round($size/$tb,2)." TB";
}
}
function imageresize($oldfilename, $newfilename, $max) {
$im1 = imagecreatefromjpeg($oldfilename);
$size = GetImageSize ($oldfilename);
$width = $size[0];
$height = $size[1];
if ($size[1] < $max && $size[0] < $max) {
imagejpeg ($im1, "$newfilename");
imagedestroy($im1);
} else {
if ($height == $width) {
$height = "$max";
$width = "$max";
} elseif ($width < $height) {
// $size = GetImageSize ("$pic");
$verhouding = $width / $height;
$height = $max;
$width = $max * $verhouding;
} elseif ($width > $height) {
$verhouding = $height / $width;
$width = $max;
$height = $max * $verhouding;
}
$im2 = imagecreatetruecolor ($width, $height);
imagecopyresized ($im2, $im1, 0, 0, 0, 0,$width, $height, $size[0], $size[1]);
imagedestroy($im1);
imagejpeg ($im2, "$newfilename");
imagedestroy($im2);
}
}
?>