"; $ret .= ""; if($prev != "") $ret .= "<<< (Föregående)"; else $ret .= "<<< (Föregående)"; $ret .= ""; $ret .= ""; global $max_run_x; $ret .= "$text"; $ret .= ""; $ret .= ""; if($next != "") $ret .= "(Nästa) >>>"; else $ret .= "(Nästa) >>>"; $ret .= ""; $ret .= ""; return $ret; } ?> Album - <? echo get_text(0); ?> read()) { if(ereg("^[0-9]+\.jpg$", $entry)) { $imgs[$entry] = $entry; } } $d->close(); ksort($imgs); // Some vals $max_thumb_x = 100; $max_thumb_y = 70; $pad = 2; $max_run_x = 800; $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 $convert = "/usr/bin/convert"; $cmd = $convert." -geometry ".$max_thumb_x."x".$max_thumb_y." $key $thumbname"; #DEB echo $cmd; 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; reset($imgs); while(list($key, $val) = each($imgs)) { $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_ptn($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"; ?>