Bildergalerie
// links display $gal = $HTTP_GET_VARS["gal"]; $pic = $HTTP_GET_VARS["pic"]; $n = 1; $links = array(); $fp = fopen("links.txt", "r"); while (!feof($fp)) { $link = fgets($fp, 500); if($link) { $links[$n] = rtrim($link); $n++; } } fclose($fp); for ($i=1; $i<=sizeof($links); $i++) { echo "".$links[$i].""; if ( $i<=(sizeof($links)-1)) { echo " | "; } } ?>
// photo display
if (!isset($gal) or trim($gal)=='') {
$gal = 1; }
if (!isset($pic) or trim($pic)=='') {
$pic = 1; }
$dir= "gallery".$gal;
@$d = dir($dir);
if ($d) {
while($entry=$d->read()) {
$entry = preg_replace("/ /","%20",$entry);
$pos = strpos (strtolower($entry), ".jpg");
if (!($pos === false)) {
$arr_pic[] = $dir."/".$entry; } }
$d->close(); }
@sort ($arr_pic);
$total = sizeof($arr_pic);
echo "";
?>
// comments display (if exists)
$cmt = $dir.".txt";
if (file_exists($cmt)) {
$n = 0;
$comment = array();
$fp = fopen($cmt, "r");
while (!feof($fp)) {
$tekst = fgets($fp, 5000);
if ($tekst) {
$comment[$n] = stripcslashes($tekst);
$n++; } }
fclose($fp);
echo $comment[$pic-1]; }
?>
// navigation display
if ( $pic<2) {
$prev_url="?gal=".$gal."&pic=1";
} else {
$prev_url='?gal='.$gal.'&pic='.($pic-1); }
if ( $pic+1>$total) {
$next_url="?gal=".$gal."&pic=".$pic;
} else {
$next_url='?gal='.$gal.'&pic='.($pic+1); }
if ( $pic-10<1) {
$skip_back_url='?gal='.$gal.'&pic=1';
} else {
$skip_back_url='?gal='.$gal.'&pic='.($pic-10); }
if ( $pic+10>$total) {
$skip_url='?gal='.$gal.'&pic='.$total;
} else {
$skip_url='?gal='.$gal.'&pic='.($pic+10); }
echo "10 zurück | ";
echo "Zurück | ";
echo $pic." von ".$total." | ";
echo "Vor | ";
echo "10 vor";
?>
© 2006-2007 Walter Werner
