Photo Gallery is a dynamic PHP photo gallery.
- Generates an index page of thumbnail images
- Provides navigational links when viewing images to the previous image, the next image, and the thumbnail index
- Allows you to specify the order in which the images are displayed
- Allows you to specify an optional caption for each image
- Allows you to specify an optional link to a parent gallery page, which would contain links to all of the individual galleries
First, dump all of the photos you want to appear in the gallery into a single directory. Each photo must have a thumbnail image associated with it, and that thumbnail must contain the same name as the original, with “-thumb.jpg” tacked onto the end. So, a photo named “family.jpg” would have a thumbnail named “family.jpg-thumb.jpg”.
In the directory containing the images, create a new file named “photos.txt”. This file specifies the order of the photos in the gallery, as well as any captions you have for each file. On each line in this file, first list the name of the full sized photo, then a comma, then an optional caption.
An example photos.txt file:
IMGA1864.JPG,Warm up practice before kyu test
IMG_1092.JPG,Signing in for the test
The index page
Now that the photos are setup, and the photos.txt file has been created, it’s time to create a PHP page to generate the gallery. We do this with a call to generate_gallery. generate_gallery takes 3 parameters. First is the location of the directory containing the photos, thumbnails, and photos.txt file. Second is the name of this PHP page. Third is an optional parameter which specifies a master photo gallery index page, which would contain links to each of your individual photo gallery pages (like this one).
<?php include_once('gallery.php'); generate_gallery("./photos/kyutest_2007_12", "kyutest_2007_12.php", "photo_galleries.php"); ?>