Yep, opendir() the directory; readdir() the images into an array (identify which files are images by their extension); sort the resulting array, then list the result.
If you want a gallery, that's trickier - but only if you're wanting thumbnails. I mean, anyone can use fake width and height attributes, but the entire image still needs to be downloaded, and who needs that sort of grief?
If you do want thumbnails, it's best if you can have the thumbnail created once when the image is added (probably via some sort of upload script). But if you want to be able to just chuck image files in the directory and have them appear when the page is next requested, you'll need to create the thumbails afresh every time - you can see how that would be a lot of extra work for the server.
Either way, you'd probably use PHP's image functions to create the thumbnails. In the preferred "create once" option, you'd be creating thumbnail files (stored in another directory) with names derived from the originals in some simple fashion. Go through the array of images, derive the thumbnail names, and throw up a bunch of <a> entities linking to the original images, inside which are the <img> tags for the thumbnails.
If you create them on the fly, then the <img> tags themselves would have to call a script to create the thumbnails. Something like <img src="thumbnail.php?file=picture1"> would be needed.