1, and current=$last, set $cur..to $last-$showmany # Tue Jun 24 09:23:46 MDT 2008 - 1.2 # finalized the $showmany # now able to view up to 3 pictures at once # with corresponding back/forward buttons # Mon Jun 23 22:04:10 MDT 2008 # Added to show many pictures at once - still a bit more to do. # Mon Jun 23 09:45:08 MDT 2008 - 1.1 # Added $skipblocks to skip forward/backwards # Tue Mar 18 11:46:57 MDT 2008 - 1.0 # Simple script for displaying a back/forward button # when viewing a directory with lots of images # image index, album views, etc. # # scripts@pknet.net # http://peterk.org/scripts/ # require("../../HEADER.php"); $files=glob("{*.jpg,*.gif,*.JPG}",GLOB_BRACE); // which files to look for $arraysize=count($files); // number of array elements $last=$arraysize-1; // last element of array sort($files); // uncomment one of the below... // start with begining of list; //$current=0; // OR // start at end of list $current=$last; if(isset($_GET['comi']) && is_numeric($_GET['comi'])) { $current=$_GET['comi']; } $self=$_SERVER['SCRIPT_NAME']; $self="$self?"; $noindexself="$self?"; if(isset($_GET['index'])) $self="$self&index"; $fourcount=50; // display links to every Nth array[] $skipblocks=7; // how many digits to go back/forward [one week] // if show default comic + $showmany sequential pictures after... if(isset($_GET['showmany']) && $_GET['showmany'] > 0 && $_GET['showmany'] < 5 && is_numeric($_GET['showmany'])) { // set $showmany to number of comics to display, // minus 1 for the default $_GET['comi'] that is displayed $showmany=$_GET['showmany']-1; $self="$self&showmany=$_GET[showmany]"; } else $showmany=0; if($current == 0 || $current < 0) { $back=$last-$showmany; $current=0; $forward=1+$showmany; $skipforward=0+$skipblocks; $skipback=$back-$skipblocks; } elseif($current >= $last) { $back=$last-1-$showmany; $current=$last-$showmany; $forward=0; $skipforward=0+$skipblocks-1; $skipback=$current-$skipblocks; } else { $back=$current-1-$showmany; $forward=$current+1+$showmany; //$current=$current; $skipforward=$current+$skipblocks; $skipback=$current-$skipblocks; } function domainhead($back,$current,$forward,$self,$skipforward,$skipback) { echo "\n"; } function domainbody($files_current,$fsize) { echo "\n"; echo "\n"; } function domainfoot() { echo "
"; echo "
    "; if(isset($_GET['index'])) echo "no index\n"; else echo "index\n"; echo "  |  \n"; echo "back\n"; echo "  |  \n"; echo "forward
\n"; if(isset($_GET['showmany']) && $_GET['showmany'] > 0) echo "No Show Many | \n"; else echo "Show Many | \n"; echo "Skipback\n"; echo "  |  \n"; echo "Skipforward
\n"; echo "--"; echo " Rotate Image FireFox plugin --

\n"; echo "
\n"; echo "$files_current\n"; echo "
\n"; echo "$files_current - $fsize\n"; echo "
\n"; } // from php.net - filesize() function byteconvert($bytes) { $s = array('B', 'Kb', 'MB', 'GB', 'TB', 'PB'); $e = floor(log($bytes)/log(1024)); return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, floor($e)))); } $fsize=byteconvert(filesize($files[$current])); domainhead($back,$current,$forward,$self,$skipforward,$skipback); domainbody($files[$current],$fsize); while ( $showmany > 0 && $current < $last && $current >= 0 ) { $current=$current+1; domainbody($files[$current],$fsize); $showmany--; } domainfoot(); // display links to comics every $fourcount echo " 0 - $files[0]
\n"; while ( $fourcount <= $arraysize ) { echo "  $fourcount - $files[$fourcount]
\n"; $fourcount=$fourcount+$fourcount; } echo " $last - $files[$last]
\n"; if(isset($_GET['index'])) { $fourcount=0; foreach ($files as &$value) { echo "
$fourcount - $value\n"; $fourcount=$fourcount+1; } } require("../../FOOTER.php"); ?>