Single File PHP Gallery 4.1.1

by Kenny Svalgaard


Single File PHP Gallery is a web gallery in one single PHP file. All you have to do is copy the script to any directory containing images to make a gallery. Sub directories will be sub galleries. Thumbnails for images and directories are generated automatically.
Single File PHP Gallery does not require any configuration or programming skills to use.

By default it looks like this:

sfpg     sfpg     sfpg
(click image to see the online demo)


  • Free for private non commercial use
  • Very simple Plug'n'Play like ease of use
  • Uses no database
  • Automatically creates thumbnails
  • Option to create and use intermediate preview images
  • Displays EXIF information
  • Rotates/corrects orientation of images using EXIF information
  • Option to add watermark to all images in gallery
  • Supports JPG, JPEG, PNG and GIF
  • Unlimited numbers of sub galleries
  • See configuration information in readme.txt for all features


For private non commercial use Single File PHP Gallery can be used for free. When used commercially a donation for at least 10$ must be made per domain where it is used. See readme.txt for full EULA.

You are of course still more than welcome to donate if you like the gallery, even though you only use it privately.

Making a donation:
Domain name must be clearly stated in the donation, otherwise the donation will not grant use of the script under donating conditions. Donations are not refundable.
Use the following PayPal donate button for donations:


For this gallery to function you will need the following:
  • A web server capable of running PHP 5 scripts
  • The PHP GD library (php_gd) installed. See here for information:
  • PHP write access to server
  • PHP memory limit large enough to contain both full size image and preview/thumb (converted to BMP) See the FAQ section in readme.txt for further information on this.


Download latest version here: Single File PHP Gallery 4.1.1
Download SFPG TEST script here: SFPG TEST

You can also download previous version, which was designed to be included on existing pages, here: Single File PHP Gallery 3.6.0


  • Internet Explorer 9 fix
    SFPG 4.1.1 contains only one small fix, making large image download not break in Internet Explorer 9.
    (the rest of the bullets are from 4.1.0)
  • EXIF extraction
    If available in image file, the following EXIF information will be shown: Date, Camera, ISO, Shutter Speed, Aperture, Focal Length and Flash fired.
  • Rotation
    Option to automaticly correct orientation of images, with information from EXIF.
  • Watermark
    Option to add watermark to all images in gallery.
  • Thumbnail for non-images
    Option for adding custom default thumbnails for file types. This can be used to have a thumbnail/icon on non-image files like PDF, AVI, ZIP or any other.
  • Dynamic size presentation
    Image and file size are shown as Bytes, KBytes, MBytes and so on.


Subscribe here to be notified via e-mail when a new version is released:

CONTACT / SUPPORT (English or Danish/Dansk)

Please use the box below if you have any comments, questions, requests, greetings etc.

If you are having problems getting the script to work, then please download the SFPG TEST script from the DOWNLOAD section above, and paste the output from it into the message, along with a description of the issue you are having.
Use the contact form on this page: Contact