$1.99
Description
Here’s a simple Single File PHP Image Gallery Script. It scans a directory for images and displays them in a grid layout. Just place this script in a folder containing images, and it will generate a gallery automatically.
Features
This script dynamically scans the current directory for images and displays them as a gallery. Just place your images in the same folder as the script, and it will generate the gallery automatically. For that reason the first open may be a little bit slower – depending on the number of images you have.
It supports also taking into account mp4 and mov videos and displays them directly (without thumbnailing)
Requirements
The script has been tested on Ubuntu with PHP 8.0
1) GD extension
- Enable GD in PHP
- If you’re using XAMPP/WAMP, open
php.iniand uncomment the line:extension=gdThen restart Apache.
- If you’re on Linux, install GD with:
sudo apt-get install php-gdThen restart Apache:
sudo service apache2 restart - If you’re on Windows, find
php.ini, search for;extension=gd, remove the;, and restart your server.
- If you’re using XAMPP/WAMP, open
- Check if GD is enabled
Run this script:<?php phpinfo(); ?>Search for “GD” in the output.
Troubleshooting
If you get a 500 error usually means a fatal PHP error.
Enable Error Reporting
Before checking anything else, modify the beginning of your script to show errors:
error_reporting(E_ALL);
ini_set('display_errors', 1);
Check File Permissions
chmod -R 755 thumbnails
![[Yet Another] Single File PHP Script Image Gallery](https://programtom.com/dev/wp-content/uploads/2025/02/Screenshot-2025-02-09-135714.png)
