Welcome to a step-by-step tutorial on how to create a very simple PHP gallery. Tired of all those “complicated” gallery plugins on the Internet? Actually, creating a raw basic image gallery is very easy:
Use the PHP glob() function to get a list of images in the gallery folder.
Output this image list in HTML.
Add some simple CSS to lay the images out nicely.
Yep. Just like that in 10 minutes. But how does this work exactly? This guide will show you how to create a no gimmicks image gallery – Directly reads image files from a folder, and with no database required at all. Read on!
ⓘ I have included a zip file with all the source code at the start of this tutorial, so you don’t have to copy-paste everything… Or if you just want to dive straight in.