$value) {if ($key!="dgallery_show"&&$key!="dgallery") {$extra=$extra."&".$key."=".urlencode($value);}}
$self=str_replace("index.php","",$_SERVER["SCRIPT_NAME"]);$file=htmlentities($_GET["dgallery_show"]);$app=htmlentities($_GET["dgallery"]);
if ($app=="browse") {
// do thumbs gallery
if ($gallery!="") { echo "
".$gallery." image gallery
"; }
echo "";$files=glob($directory.$dgallery_imagefilemask);
foreach ($files as $thumb) {
echo "
"; }
echo "
"; } else {
// show specified image
if (!file_exists($file)) { $files=glob($directory.$dgallery_imagefilemask);$file=$files[0]; } // use first image if none specified
// quick and dirty hack for showing commentary
if (file_exists($file.".html")) { echo file_get_contents($file.".html"); }
if (file_exists($file)) {
$navstring="";$dgallery_thumbstylecurrent="border:2px solid blue;";$dgallery_thumbstyleothers="margin:1px;border:1px solid black;";
$navstyle="display:block;text-align:center;line-height:".$dgallery_thumbheight."px;background-color:black ! important;color:white ! important;width:22px;text-decoration:none ! important;";$maxrange=($dgallery_thumbsrange*2)+1;
$files=glob($directory.$dgallery_imagefilemask);$last=count($files)-1;$pos=array_search($file,$files)+1-1;
$prev=$pos-1; if ($prev<0) { $prev=0; }
$next=$pos+1; if ($next>$last) { $next=$last; }
$navstring.="| |◄ | ◄ | ";
$pointer=0;$test=$files[0];if ($file) { $test=$file; }
$startshow=$pos-$dgallery_thumbsrange; if ($last-$pos<$dgallery_thumbsrange) {$startshow=$startshow-($dgallery_thumbsrange-($last-$pos));}
if ($startshow<0) { $startshow=0; }
foreach ($files as $thumb) {
$show=FALSE;if ($last<=$maxrange) { $show=TRUE; }
if ($pointer>=$startshow&&$pointer<$startshow+$maxrange) { $show=TRUE; }
if ($show==TRUE) { $temp=$dgallery_thumbstyleothers; if ($test==$thumb) { $temp=$dgallery_thumbstylecurrent; }
$navstring.="."/".$thumb."&h=".$dgallery_thumbheight."\") | "; }
$pointer++;
}
$navstring.="► | ►| |
";
if ($dgallery_thumbsposition!=1) { echo $navstring; }
if ($dgallery_infoandbrowse!=1&&$dgallery_infoandbrowse!=3) { echo "".$dgallery_title." ".($pos+1)." of ".($last+1)." / Browse all
"; }
echo "";
if ($dgallery_fullsizelinks) { echo ""; }
if ($dgallery_hardresize) {
echo "
"; } else {
echo "
".$dgallery_maxwidth."){width=".$dgallery_maxwidth.";}\">"; }
if ($dgallery_fullsizelinks) { echo "
"; } else { echo ""; }
if ($dgallery_infoandbrowse>0&&$dgallery_infoandbrowse!=3) { echo "Showing image ".($pos+1)." of ".($last+1)." / Browse all
"; }
if ($dgallery_thumbsposition>0) { echo $navstring; }
}
}
}
//
// GENERAL USAGE
//
// include "/path_to_script_from_root/dgallery.php";
// dgallery("relative_path_to_images_from_document_the_script_is_included_in/");
//
// SPECIFIC EXAMPLE
//
// include $_SERVER["DOCUMENT_ROOT"]."/common/dgallery.php";
// $dgallery_thumbheight=60; $dgallery_maxwidth=600; $dgallery_hardresize=FALSE;
// dgallery("images/");
//
?>