ok .. now i've got it except for two things
1) the "displaying 'x' to 'x' of 'x' images' needs to be worked out
2) if you are on the first page and click 'next' it kills the first file and reads the last file from the previous page. I think it has to do w/ $filelist[$i-1]. I've been playing with that, but no success. All my files are labeled 01, 02, 03, etc. for testing.
Here's where I'm at now.
$page = (isset($_GET['page'])) ? $_GET['page'] : 0;
if ($dir = @opendir("my/directory")){
while (($file = readdir($dir)) !== false){
if($file != ".." && $file != "."){
$filelist[] = $file;
}
}
closedir($dir);
sort($filelist);
}
print $page."<< PAGE NUMBER<br><br>";
$filecount = count($filelist);
$limit = 20; // allow 20 images per page
if ($filecount > $limit){
$filelist[$limit] = $file;
}
$from = $limit * $page;
$to = $from + $limit;
$pages = $filecount/$limit;
$start = $page * $limit;
$na = $page + $limit;
$next = $page + 1;
$back = $page - 1;
$last = $last = round($pages, 00) - 1;
$first = 0;
// count current files
for($i=$start; $i<=$to;$i++){
if($i == $filecount){
}
}
print "Displaying ".$na." to ".$start." of ".$filecount." images - ".$pages." Pages to show images on<br><br>";
if ($i < $filecount){
print "<a href=\"$HTTP_SERVER_VARS[PHP_SELF]?page=$next\">NEXT</a> ";
print "<a href=\"$HTTP_SERVER_VARS[PHP_SELF]?page=$last\">LAST</a> ";
}
if ($page != "0" && $i!= $filecount){
print "<a href=\"$HTTP_SERVER_VARS[PHP_SELF]?page=$back\">BACK</a> ";
print "<a href=\"$HTTP_SERVER_VARS[PHP_SELF]?page=$first\">FIRST</a> ";
}
// list files
print "<br><br>";
for($i=$start; $i<=$to;$i++){
print $filelist[$i-1]."<br>";
if($i == $filecount){
print "END";
}
}