"; $ret .= ""; if($prev != "") $ret .= "<<< (".PREV.")"; else $ret .= "<<< (".PREV.")"; $ret .= ""; $ret .= ""; $ret .= "$text"; $ret .= ""; $ret .= ""; if($next != "") $ret .= "(".NEXT.") >>>"; else $ret .= "(".NEXT.") >>>"; $ret .= ""; $ret .= ""; return $ret; } ?> Album - <? echo get_text(0); ?> read()) { if(ereg("^[0-9]+\.jpg$", $entry)) { $imgs[$entry] = $entry; } } $d->close(); ksort($imgs); $run_x = 0; // Check for cached thumbnails reset($imgs); while(list($key, $val) = each($imgs)) { $img_num = substr($key, 0, -4); $thumbname = $img_num."_".MAX_THUMB_X."_".MAX_THUMB_Y.".jpg"; if(!file_exists($thumbname)) { // Go create the cache copy $cmd = CMD_CONVERT." -geometry ".MAX_THUMB_X."x".MAX_THUMB_Y." $key $thumbname"; exec(escapeshellcmd($cmd)); flush(); } } // Which image do we show? if(!isset($img)) { // use first reset($imgs); list($key, $val) = each($imgs); $use_img = $key; } else { $use_img = $img; } // Show thumbnail gallery echo "\r\n"; $prev = $next = ""; $cnt = 0; foreach($imgs as $key => $val) { $cnt++; if($last == $use_img) { // Previous was the img selected. $next = $key; // Use this as next img } if($key == $use_img) { // This is the img selected $prev = $last; $idx = $cnt; } $last = $key; $run_x += MAX_THUMB_X+PAD*2; if($run_x > MAX_RUN_X) { // Break rows when wide enough echo "\r\n"; $run_x = MAX_THUMB_X+PAD*2; } $img_num = substr($key, 0, -4); $thumbname = $img_num."_".MAX_THUMB_X."_".MAX_THUMB_Y.".jpg"; $thumb = getimagesize($thumbname); $wh = $thumb[3]; // Td with thumbnail picture echo "\r\n"; } echo "
\"$key\"
\r\n"; // Top nav echo ""; $text = get_text($idx); $prev_text_next = fmt_nav($prev, $text, $next); echo $prev_text_next; echo "
\r\n"; // Show image if($next) echo ""; $imgsize = getimagesize($use_img); echo "\"$text\""; if($next) echo ""; echo "\r\n"; // Bottom nav echo ""; echo $prev_text_next; echo "
\r\n"; ?>