You can use the following php code; I wrote it once really quick, and never bothered optimizing it. have fun. pour some prego on this, and you're guranteed to have spagetti code.
<table width = 200 cellspacing = 1 cellpadding = 2>
<tr>
<?
$directory = opendir("$directory");
$maxtop = 5;
//check for start
if(!(isset($substart)))
{ $start = 1;}
else
{ $start = $substart; }
//check for stop
if(!(isset($substop)))
{ $stop = 4; }
else
{ $stop = $substop; }
for($loop = $start; $loop <= $stop; $loop = $loop + 1)
{
if ($loop >= 17) // $loop = maxnumber of images
{
$breakout = 1;
print("<td><b>End of images</b></td>");
break;
}
$checknl = $loop/2;
print("<td>
<font size=\"1\" face =\"Arial\">");
if ($start == 1)
{
print("<A HREF=\"index.php?action=gallery&display=im$loop.jpg\"><img src=\"gallery/im$loop.jpg\" width=\"100\" height=\"100\" border=\"0\"><br>View</A>");
}
else
{
print("<A HREF=\"index.php?action=gallery&display=im$loop.jpg&substart=$substart&substop=$substop\"><img src=\"gallery/im$loop.jpg\" width=\"100\" height=\"100\" border=\"0\"><br>View</A>");
}
// check for next page indicies
if(is_integer($loop/4))
{
$substart = $start + 4;
$substop = $stop + 4;
}
//check for next page link
if($loop == $stop)
{
print("<A HREF=\"index.php?action=gallery&substart=$substart&substop=$substop\"> Next</a>");
}
print("</font></td>");
if(is_integer($checknl))
{ print("</tr>\n<tr>\n"); }
}
?>
</tr>
</table>