<?php
//Door Tom Lustig
$dir = "School"; // Dir van je foto's
$Gal = "Members Foto's"; // Titel
$thumb = "thumbs"; // Thumbs directory naam
$thumbwidth = "100"; // Width van een thumbnail
$imagequality = "100"; // Foto kwaliteit, in procenten
$cols = "4"; // Aantal kolommen
$vi = "Bekijk Foto"; // Text voor link van foto bekijken
$sname = "fotos.php"; // Naam van deze file
$isz = "Grote"; // Text voor grote
$msgnav = "Bekijk FotoGallery"; // Text voor het bekijken van de gallery
$msgcp = "Foto"; // Text voor een foto
$msgof = "van"; // Text voor foto 1 VAN 24
$msgback = "Terug naar het album"; // Text voor link naar de gallery
if (isset($_GET['iid'])) { $_GET['iid'];
} elseif (isset($_POST['iid'])) { $_POST['iid'];
}
while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") {
if (eregi("\.jpe?g$", $file) || eregi("\.gif$", $file) || eregi("\.png$", $file)) { $files[] = $file;
}
}
}
}
}
$i = 0;
foreach ($files as $image) {
$thumbimage = $thumb."/".$image;
$width = $size[0];
$height = $size[1];
$type = $size[2];
if (!$thumb_exists) {
switch ($type) {
case 1 :
$im = ImageCreateFromGIF($image);
break;
case 2 :
$im = ImageCreateFromJPEG($image);
break;
case 3 :
$im = ImageCreateFromPNG($image);
break;
}
$newwidth = $thumbwidth;
$newheight = ($newwidth / $width) * $height;
$im2 = ImageCreateTrueColor($newwidth,$newheight);
ImageCopyResampled($im2,$im,0,0,0,0,$newwidth,$newheight,$width,$height);
switch ($type) {
case 1:
ImageGIF($im2, $thumbimage);
break;
case 2:
ImageJpeg($im2, $thumbimage, $imagequality);
break;
case 3:
ImagePNG($im2, $thumbimage);
break;
imagedestroy($im);
imagedestroy($im2);
}
}
$th[$i] = $thumbimage;
$iw[$i] = $width;
$ih[$i] = $height;
$i++;
}
echo "<p align=\"center\"><font size=\"4\" color=\"#000000\">" . $Gal . "</font></p>"; echo "<table border=\"1\" align=\"center\" bordercolor=\"#000000\" cellspacing=\"3\" cellpadding=\"3\">"; // Dit kan je natuurlijk naar je eigen style aanpassen if (($rows * $cols) < (count($th))) { $rows++;
}
for ($i = 1; $i <= $rows; $i++) {
for ($j = 1; $j <= $cols; $j++) {
$td = (($i - 1) * $cols) + $j;
$iu = ($td - 1);
$op = "";
$op .= "<td>\n<div align=\"center\">\n<br>\n";
$op .= "<a title=\"" . $vi . "\" href=\"" . $sname . "?iid=" .$iu . "\">\n";
$op .= "<img src=\"" . $th[$iu] . "\" border=\"0\">\n";
$op .= "<br>" . $isz . ": " . $hw[$iu] . " x" . $ih[$iu] . "\n";
$op .= "<br>" . $ifs[$iu] . " Kb.</a>\n";
$op .= "<br>\n</div>\n</td>\n";
} else {
echo "<td>\n<br></td>\n"; }
}
}
} else {
$iid2 = $iid+1;
$op = "";
$op .= "<tr>\n<td>\n<div align=\"center\"> " . $msgnav . " " . $Gal . " :: " . $msgcp . " " . $iid2 . " " . $msgof . " " . $tot . " </td>\n</tr>\n<tr>\n";
$op .= "<td>\n<div align=\"center\">\n<br>\n";
$op .= "<img src=\"" . $files[$iid] . "\" border=\"0\">\n";
$op .= "<br>" . $isz . " " . $iw[$iid] . " x " . $ih[$iid] . "\n";
$op .= "<br>" . $ifs[$iid] . " Kb.</a>\n";
$op .= "<br>\n</div>\n</td>\n</tr>\n";
$op .= "<tr>\n<td>\n<div align=\"center\"><a href=\"" . $sname . "\"> " . $msgback . " </a></div></td></tr>";
}
?>