While there are a variety of ways to create a gallery, one of the first I learned was using PHP. The main purpose of this project was to gain an understanding of uploading and resizing images, adding a watermark if so desired.
A visitor to the site would be shown a grid of thumbnails, which when clicked on would bring the user to a page displaying a large version of the image with caption.
Using a secure login, a user could then upload their own photos to the gallery. A custom function would take the original image and resize it to create a thumbnail which would then be used on the index page.