Single File PHP Gallery 4.5.7

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
  • Slideshow option
  • PayPal integration with inventory counter for simple selling
  • Displays EXIF and IPTC information
  • Option to password protect gallery
  • Option to delete directories, images and files
  • Rotates images using EXIF information
  • 3D MPO red/cyan anaglyph and stereo image generation
  • Keyboard navigation
  • Option to create and use intermediate preview images
  • Option to add watermark to all images in gallery
  • Supports JPG, JPEG, PNG, GIF and MPO
  • Unlimited numbers of sub galleries
  • See configuration information 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.5.7 (34kB)
Download SFPG TEST script here: SFPG TEST 1.5.0 (3kB)

NEWS IN SFPG 4.5.7 (20-May-2015)

  • Added touch device detection to work better on iOS (Making javascript onMouseOver events also act as onClick events)
  • Fixed/Added extraction of missing IPTC Creation Date.
  • Added check to hide empty fields in EXIF and IPTC information boxes. Only entries containing data will be shown.
  • Added the NL_TO_BR that was removed in previous version. It is now called DESC_NL_TO_BR.
  • Added meta viewport definition to better function with mobile devices.
  • Added automatic generation of SECURITY_PHRASE. See SECURITY_PHRASE section for details.
  • Fixed so that thumbnails for directories now also regenerate automatically if the source file time change. (You need to access the folder to trigger the regeneration).
  • Removed the ALLOW_DESC_HTML option. All descriptions are now treated as HTML.
  • Minor fixes and improvements.

See here for changes in previous versions: Single File PHP Gallery Version History


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

CONTACT / SUPPORT (English or Danish/Dansk)

Please use the link 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