I am new to PHP (VB is my weapon of choice!) and I am trying to make an image viewer. I have a large number (say around 2000) of small images in a directory on my website. I would like to display around 25 on a web page with simple Next Page / Previous Page navigation. I don't need thumbnails as the images themselves are only 320 x 256. I don't know all the filenames and I don't know exactly how many images there are. I currently have PHP that displays ALL the images in the current directory. It works well but obviously is a bit slow to load with a large number of images:

Code:
<?php

//path to current directory
$directory = "./";
 
//get all files with a .jpg extension
$images = glob($directory . "*.jpg");

?>

<html>
	<body bgcolor="#EEEEEE" style='font-family: Arial'>
<?php
echo("<p><b><font face='arial black,arial' size='6' color='#004488'>G4IJE SSTV Archive</font></b></p>");
echo("<p><a href='http://www.classicsstv.com/rxpics.htm'>Click here to return to the main SSTV pics page</a></p>");
foreach($images as $image)
{
echo("<img src=\"$image\" border='1' hspace='2' vspace='2'/>");  
}
echo("<p><a href='http://www.classicsstv.com/rxpics.htm'>Click here to return to the main SSTV pics page</a></p>");
?>
	</body>
</html>
Can someone point me in the right direction to convert the above code to display around 25 images at a time? I'm sure I can find out how to get the number of items in the array (count?) and use a For-Next rather than For-Each, and can probably manage to output a page of 25 images, but what functionality is needed to create a "Next" or "Previous" page? In other words, having generated a page of images, how does one use PHP to "refresh" the page with the next batch of images?

Thanks for your help.