Deprecated: Function split() is deprecated in /home/leinir/public_html/leinir/shared-urls.php on line 187

Warning: Cannot modify header information - headers already sent by (output started at /home/leinir/public_html/leinir/shared-urls.php:187) in /home/leinir/public_html/leinir/theming.php on line 256
..leinir's online home - Snippets

PHP Gallery Script, v 1.0

gallery screenshotThe gallery script (formerly used all over the place on this site) is the product of some 6 or so hours of hard coding work and consists of two scripts: The gallery.php script itself, and the thumb.php thumbnail generator script. When downloading these two files, remember to remove the .txt extension before trying to use them.

Usage information:

  • Place the gallery.php and thumb.php script in the same directory as the file you place the code bellow in

  • Place the pictures in any arbitrary folder, called the gallery base, and then in a subfolder under that, called the gallery.

  • If the gallery is not set in the URL, the default name in this example will be "main".

  • Hover over the code to get explanations for the different parts.

<?PHP

if ($gallery == "") $gallery = "main";

If the gallery was not set from the URI... / Change this to the folder under the gallery base where the default gallery is. This would normally be set from the URI (for example: pictures.php?gallery=main)

$gallerybase = "gallery/";

Change this to the path to the gallery, including the trailing slash

include "gallery.php";

Place this where you wish the gallery table to be drawn. This must be after the two pieces of code above!

?>

Drop-in Gallery

Using the drop-in gallery is ultra-simple. Decompress, drop files into the pictures folder, give people the address to the index.php file, and that's it. You then have a gallery much resembling my gallery elsewhere-, only with a simpler layout.

Download

Gallery renderer: gallery.php.txt (1.99 KB)

Thumbnail generator: thumb.php.txt (504 B)

Drop-in gallery: gallery.tar.bz2 (29.5 KB)