// Filestructuur voor geautomatiseerd foto-album: // Directory waarin // * Dit bestand : photopage.php // * Thumbs-creator : thumb.php // * Subdirectories met foto's : /FotoXXX, waarbij xxx als GET parameter "fd" wordt meegegeven. // elke subdirectory bevat een bestand "config.php" met een aantal settings qua kleuren en zo. //GET parameter fotodirectory 'fd=' $fotoDir = "0".$_GET["fd"]."/"; if (!is_dir($fotoDir)) die ('Fout : fotofolder niet gevonden'); //GET parameter (horizontal) screen resolution "res" $resX = max($_GET["res"],800); //minimum resulution 800x600 $spcX = (0.95*$resX) - 120; // available space for thumbs (120 = navbar width) $spcY = (0.75*$_GET["res"]) - 220; //220 = estimated loss for toolbars and headers //Read folderspecifieke parameters $paramFile = $fotoDir."config.php"; if (is_file($paramFile)) require $paramFile; else die ('Fout : Geen parameterfile in fotofolder'); //Thumbnail related params $thumb_size = 120; //Max height (portrait) or width (landscape) of a thumb $thumb_cols = floor(($spcX - 5) / ($thumb_size + 5)); //#thumbs/row (5=spacing) $thumb_cellsz = floor($spcX / $thumb_cols); //set OR calculate rows from size and resolution //$thumb_rows = 4; $thumb_rows = floor($spcY / $thumb_cellsz); $thumbs_per_page = $thumb_rows * $thumb_cols; // Read pictures in photo directory $imgCount = 0; if ($dh = opendir($fotoDir)) { while (($f = readdir($dh)) !== false) { if (substr(strtolower($f),-3) == "jpg") { //alleen JPG formaat ondersteund. $imgInfo = getimagesize($fotoDir.$f); $imgWidth = $imgInfo[0]; $imgHeight = $imgInfo[1]; $imgCount++; $imgArr[] = array('imgFileName'=>$f, 'imgWidth'=>$imgWidth, 'imgHeight'=>$imgHeight); } } closedir($dh); if ($imgCount > 0) sort ($imgArr); } //GET desired view // One can switch between fotoview and overview or between fotoview and showview. // There is no switching between overview and showview directly. if (!isset($_GET["vw"])) $view="foto"; //default value else $view = strtolower($_GET["vw"]); if ($view == "ovvw") { $altview = "foto"; }elseif ($view == "foto") { $altview = "ovvw"; } elseif ($view == "show") { $altview = "foto"; }else{ die ('Fout : ongeldig view gevraagd'); } //GET desired foto number $no = max ($_GET["no"], 1); if ($imgCount > 0) { $no = min($no, $imgCount); } ?>
echo($weekinfo); ?> |
||||||||
//Determine visible section of album
if ($imgCount > 0) {
if ($view == "ovvw") { // thumbs page asked
$firstImg = ($no-1) - (($no-1) % $thumbs_per_page);
$lastImg = min($firstImg+$thumbs_per_page,$imgCount)-1;
$images = ($lastImg - $firstImg) + 1;
$rowCnt = ceil($images / $thumb_cols);
$colCnt = $thumb_cols;
$cellwidth = " width=".$thumb_cellsz;
$imgsize = $thumb_size;
}else{ //single photo asked
$firstImg = $no-1;
$lastImg = $firstImg;
$images = 1;
$rowCnt = 1;
$colCnt = 1;
$cellwidth = "";
$imgsize = $spcY;
}
//prepare link to alternative view
$linkstr = $_SERVER["PHP_SELF"].'?fd='.$_GET["fd"].'&res='.$_GET["res"].'&vw='.$altview.'&no=';
//actual display
$i = $firstImg;
echo ("
Helaas (nog) geen foto's beschikbaar."); $firstImg = $lastImg = $imgCount; } ?> |
$linkstr = $_SERVER["PHP_SELF"].'?fd='.$_GET["fd"].'&res='.$_GET["res"];
$same = $linkstr.'&vw='.$view.'&no=';
$other = $linkstr.'&vw='.$altview.'&no=';
$show = $linkstr.'&vw=show&no=';
if ($view=="ovvw") { //picture range in overview
echo (" Foto's Foto
|