http://us2.php.net/manual/en/function.scandir.php tells you how to read a directory.
To add items into an array, you can use a while() or for() loop, then use array_push() or array_unshift() to put files into the array one at a time.
To display, simply write your script to write an html <table> and fill the <td> items with a picture that you array_shift() or array_pop() out of your array of listed files.
There's a basic methodology for you to design for. If you don't have time to design, then you might google for a script that's already prebuilt.