'; echo ''; echo '
'; echo '
'; // --end html header // --begin preprocessing extract($_GET); //error_reporting(E_ALL); //foreach ($_GET as $key => $name) { // echo 'GET:'.$key.': '.$name."
\r\n"; //} //foreach ($_POST as $key => $name) { // echo 'POST:'.$key.': '.$name."
\r\n"; //} // add upper case to filetypes $k = sizeof($filetypes); for ($i=0; $i<$k; $i++) { $filetypes[] = strtoupper($filetypes[$i]); } // language $language = strtolower($language); $addcomments = strtolower($addcomments); if (($language == "german")||($language == "deutsch")) { $label_all = "Alle Bilder"; $label_nothumb = "Fr diesen Ordner gibt es keine Vorschau."; $label_start = "Starte Fotoalbum"; if ($addcomments == "yes") { $error_noauthor = "FEHLER: Das Feld \"$label_author\" ist leer!"; $error_nomsg = "FEHLER: Das Feld \"$label_msg\" ist leer!"; } } else { $label_start = "start gallery"; if ($addcomments == "yes") { $error_noauthor = "ERROR: field \"$label_author\" is empty!"; $error_nomsg = "ERROR: field \"$label_msg\" is empty!"; } } // extract local image folders if (strpos($root_dir,'www')===0) $root_dir = 'http://'.$root_dir; $local = parse_url($root_dir); if (strpos($root_dir,'http://')===0) { foreach (count_chars($phpself,1) as $i=>$val) { if (chr($i)=='/') { $root_dir = substr($local['path'],1); for ($j=1;$j<$val;$j++) $root_dir='../'.$root_dir; } } if (strpos($root_dir,$local['path'])===0) { $root_dir = "."; } } // scanning directory for folders and check if they contain image files if (!is_dir($root_dir)) { echo "
"; echo "
ERROR: Couldn't open folder $root_dir !
"; exit(); } $root_handle = opendir($root_dir); while ($dirname = readdir($root_handle)) { $var1 = strcmp($dirname,'.'); $var2 = strcmp($dirname,'..'); $var3 = is_dir($root_dir.'/'.$dirname); if (($var1!=0) && ($var2!=0) && ($var3==1)) { $dir_handle = opendir($root_dir.'/'.$dirname); $postmp = 0; while ($filename = readdir($dir_handle)) { for ($i=0;$i0) { $folders[] = $root_dir.'/'.$dirname; break 2; } } } closedir($dir_handle); } } if (!$folders) { echo "
"; echo "
ERROR: Searched folders don't contain any image! Please change the \$root_dir.
"; echo "
"; exit(); } // !!! if you dont want your folders in reverse order change rsort() to sort() rsort($folders); // set initial variables if (!isset($ordner)) $ordner = $folders[0]; if (!isset($tminus)&&!isset($tplus)&&!isset($tminus_x)&&!isset($tplus_x)&&!isset($minus)&&!isset($plus)&&!isset($minus_x)&&!isset($plus_x)&&!isset($thumbnails)&&!isset($all)) $one="set"; if (strcmp($firstpage, 'thumbnails')==0) { if (!isset($single)&&!isset($plus)&&!isset($minus)&&!isset($minus_x)&&!isset($plus_x)) $single = 0; if ((isset($one)&&($single==0))||isset($OK)||isset($OK_x)) $thumbnails = "thumbnails"; if (isset($page)&&(isset($OK)||isset($OK_x))) $page = 0; } if (!isset($bild)) $bild = 1; if (!isset($tminus)&&!isset($tplus)&&!isset($tminus_x)&&!isset($tplus_x)) $thumbs = 0; // scanning directories for image files if (is_dir($ordner)){ $dir_handle = opendir($ordner); while ($filename = readdir($dir_handle)) { for ($i=0; $i 0)) { $files[] = $filename; } if ($filename=="thumbnails") { $thumbs = 1; } } } sort($files); $size = sizeof($files); closedir($dir_handle); closedir($root_handle); } else { echo "
"; echo "
ERROR: $ordner is not a folder.
"; echo "
"; exit(); } // --end preprocessing // --begin form echo ""; echo ""; // plus and minus buttons if (isset($plus)||isset($plus_x)) { if($bild<$size) $bild = $bild+1; else $bild = 1; } if (isset($minus)||isset($minus_x)) { if ($bild>1) $bild = $bild-1; else $bild = $size; } if(isset($bild)) echo ""; if (strcmp($firstpage, 'thumbnails')==0) echo ""; // only if $one selected show plus and minus buttons (for single pic view) if (!isset($all)&&!isset($thumbnails)&&!isset($tplus)&&!isset($tminus)&&!isset($tminus_x)&&!isset($tplus_x)) { echo ""; } // only if $thumbnail selected show tplus and tminus buttons (for thumbnails view) if ($thumbs) { if ((isset($thumbnails)||isset($tplus)||isset($tminus)||isset($tminus_x)||isset($tplus_x))&&!isset($all)) { if (!isset($page)||$page=="") $page=0; if (isset($tplus)||isset($tplus_x)) $page++; if (isset($tminus)||isset($tminus_x)) $page--; $psize = intval($size/($MAXX*$MAXY)); if ($size%($MAXX*$MAXY)==0) $j = 1; else $j = 0; $count=$page*($MAXX*$MAXY); if ($count>=$size) { $page=0; $count=0; } if ($count<0) { $page=$psize-$j; $count=$page*($MAXX*$MAXY); } echo "
"; if ((strcmp($firstpage, 'thumbnails')==0)&&isset($single)) while ($folder = each($folders)) { if ($ordner == $folder["value"]) { echo ""; } echo ""; // !!! uncomment these line if you want the button shown below the select field. additionally add "colspan=2" in the tag above //echo "
"; // !!! uncomment if you want to use an image button instead of << //echo ""; echo "$bild / $size"; echo ""; // !!! uncomment if you want to use an image button instead of >> //echo ""; echo ""; echo ""; // !!! uncomment if you want to use an image button instead of << //echo ""; echo "".($page+1)." / ".($psize+1-$j).""; echo ""; // !!! uncomment if you want to use an image button instead of >> //echo ""; } } else { if(isset($page)) echo ""; } echo "
\n"; // --end form // --begin print images // thumbnails if ((isset($thumbnails)||isset($tplus)||isset($tminus)||isset($tplus_x)||isset($tminus_x))&&!isset($all)) { if ($thumbs) { $leftborder = ($maxwidth - intval($MAXX * ($thumbwidth+4)))/2; $leftborder -= 2; if(($page+1)==($psize+1-$j)){ $divheight = (($thumbwidth+4) * ceil(($size-($page*$MAXY*$MAXX)) / $MAXX))+6; } else{ $divheight = (($thumbwidth+4) * $MAXY)+6; } echo "
"; $thumbheight = floor($thumbwidth*3/4); $xpos=$leftborder; $ypos=4; for ($y=0;$y<$MAXY;$y++) { for ($x=0;$x<$MAXX;$x++) { $tn_src = $ordner."/thumbnails/tn_".$files[$count]; if (strcmp($firstpage, 'thumbnails')==0) { if (file_exists($tn_src)) { $image = GetImageSize($tn_src); if ($image[0]==$image[1]){} elseif ($image[0]<$image[1]) $xpos += intval(($image[1]-$image[0])/2); else $ypos += intval(($image[0]-$image[1])/2); echo "
"; echo ""; echo "\"$files[$count]\"
\n"; if ($image[0]==$image[1]){} elseif ($image[0]<$image[1]) $xpos -= intval(($image[1]-$image[0])/2); else $ypos -= intval(($image[0]-$image[1])/2); } else { $ypos += intval(($thumbwidth-$thumbheight)/2); echo "
"; echo "$files[$count]"; echo "
\n"; $ypos -= intval(($thumbwidth-$thumbheight)/2); } } else { if (file_exists($tn_src)) { $image = GetImageSize($tn_src); if ($image[0]==$image[1]){} elseif ($image[0]<$image[1]) $xpos += intval(($image[1]-$image[0])/2); else $ypos += intval(($image[0]-$image[1])/2); echo "
"; echo ""; echo "\"$files[$count]\"
\n"; if ($image[0]==$image[1]){} elseif ($image[0]<$image[1]) $xpos -= intval(($image[1]-$image[0])/2); else $ypos -= intval(($image[0]-$image[1])/2); } else { $ypos += intval(($thumbwidth-$thumbheight)/2); echo "
"; echo "$files[$count]"; echo "
\n"; $ypos -= intval(($thumbwidth-$thumbheight)/2); } } $count++; $xpos += $thumbwidth+4; if ($count==$size) break; } echo "
"; $xpos=$leftborder; $ypos += $thumbwidth+4; if ($count==$size) break; } echo "
\n"; } else { if (strcmp($firstpage, 'thumbnails')==0) { echo "
"; echo "


$label_nothumb "; echo "".$label_start."
"; echo "
\n"; } else { echo "
"; echo "


$label_nothumb "; echo "".$label_start."
"; echo "
\n"; } } } // all pictures if (isset($all)) { // --begin comments $comment = $ordner."/comments.txt"; if (file_exists($comment)) { $handle = fopen($comment,"r"); while($inhalt = fgetcsv($handle, 1024, "|")) { if ($inhalt[1] == "") { echo '
'.$inhalt[2].'
'; } else { echo '
'.$inhalt[2].'
'; echo '
'.$inhalt[1].'
'; } } fclose ($handle); } // --end comments $count = 0; echo "
"; while ($file = each($files)) { if (strcmp($firstpage, 'thumbnails')==0) echo "\"\""; $count++; if ($count"; } echo "
\n"; } // single picture if (!isset($all)&&!isset($thumbnails)&&!isset($tplus)&&!isset($tminus)&&!isset($tminus_x)&&!isset($tplus_x)) { // --begin comments extract($_POST); $comment = $ordner."/comments.txt"; if(file_exists($comment)) { if (isset($say)&&($addcomments=="yes")) { if (!isset($msg)||$msg == "") { echo "
"; echo "
$error_nomsg
"; echo "
"; } else { if(!is_writeable($comment)) { echo "
"; echo "
ERROR: comments.txt is not writeable.
"; echo "
"; } else { $file = file($comment); $whandle = fopen($comment,"w+"); foreach ($file as $line) { fputs($whandle, "$line"); } $temp = $files[$bild-1]; if (isset($author)) $author = stripslashes($author); $msg = stripslashes($msg); fputs($whandle, "$temp|$author|$msg \n"); fclose ($whandle); } } } $handle = fopen($comment,"r"); while($inhalt = fgetcsv($handle, 1024, "|")) { if (strcmp($inhalt[0], $files[$bild-1]) === 0) { $editcomments = 1; if ($inhalt[1] == "") { echo '
'.$inhalt[2].'
'; } else { echo '
'.$inhalt[2].'
'; echo '
'.$inhalt[1].'
'; } } } fclose ($handle); if (!isset($editcomments)) { echo '
'; echo ""; echo ""; echo "
".$label_msg.":
".$label_author.":
"; echo "
"; echo ""; echo ""; echo ""; echo "
"; } } // --end comments echo "
"; echo "\"\""; echo "
"; // --end print images echo ""; } echo "
\n"; // please do not delete the copyright link. You may edit the color and size in the style.css. echo '
'; ?>