Updated 2/6/2010 — Read more below!
It’s not a complicated script, and it doesn’t do a whole lot for you: but, assuming you’re running on Linux with PHP, it’ll be incredibly easy for you to install and configure. View the sample installation.
What’s in the Package?
There are six main files included in this zip package (Version 1.2):
gallery.php— the photo gallery script.
index.php— the home file which includes the gallery script and
contains configuration info.You can copy this page to create additional galleries just by saving it with a new name and changing the configuration information.
test.phpis a second example referencing a separate gallery, to demonstrate the multiple gallery features.
titles.txt— a simple text file which uses pipe-separated fields to indicate the image name, an image description, and an
title.php— a script which provides a unique title element for each image in the gallery.
basic_styles.css— a very basic stylesheet so that your default photo gallery doesn’t look too boring. Warning: no attempt whatsoever has been made to test these styles outside of Firefox.
readme.txt— installation instructions
I’ve also supplied a (very) small gallery of images for the included gallery.
What does the script do?
This is pretty straightforward. The configuration information you’ll send to the script provides the title of the gallery, the relative path to your images folder, and the name of your text file containing the image information. Using this information, the gallery script creates a page containing (in order):
- Navigation links to move between the previous and next images in the gallery. The sequence is the order in which you’ve listed the images in your text file. The navigation is circular, so in the initial position the previous link will send you to the last image in the gallery.
- A full size image with a caption. The caption is the second field in your text file.
- An unordered list of thumbnail images in the gallery. Again, the order is from the text file. In the default styling, the list is displayed as a panel of images rather than as a list. Each image is a link to the full sized image within the gallery.
The script does NOT automatically generate your thumbnail images. Sure, I could have done that — but my feeling is that manually creating thumbnail images will usually be more aesthetically pleasing. My preference is to create 80×80 square thumbnails cropped from the image. The tiling effect of the unordered list is much more effective with square thumbnails; and the ability to choose a particular section of the image for the thumbnail is much nicer than whatever programmatically selected truncation might have done.
Some Small Recommendations
The script allows the ability to use an alt text on your images. It also provides a description which can be used to caption the images in a paragraph either over or under the image. To me, it’s redundant to provide both descriptive text associated with the image AND a descriptive alt attribute. Therefore, I’ve also provided the option to turn off alt text in the full sized images. The default settings are what I’d recommend: visible descriptions enabled for the full size image, alt attributes left blank, and alt attributes enabled for all thumbnails.
I also recommend keeping your alt attributes short and to the point. The reason for having separate descriptions and alt attributes is because they serve different purposes: don’t try and use the description field as an alt attribute and don’t try and use the alt field for a description!
There’s nothing fancy about this script. Really — I mean it. It’s down and dirty “make me a photo gallery” programming. Use at your own risk!
Changes as of 2/6/2010
- Improved pagination feature, adding a control to set the number of visible page links at a time.
- Simplified support for multiple galleries.
- Generate a list of available photo galleries.
- Navigate through multiple galleries continuously.
- Separated most configuration options into an external file, rather than configuring the same options for every gallery.
These changes are very substantial to the core code; although the majority of the actual code has remained the same, the structure of the code usage has been significantly revised. See the
readme.txt for details on usage.
On the whole, this should be easier than ever before; although you may be in for a little work if you’re trying to revise.
Note: The basic output (HTML (HyperText Markup Language), unique ID’s, classes, etc.) is unchanged. The format of the titles.txt file is unchanged. The only changes are in the addition of new features, in the way configuration options are set up, and in the way information is output from the scripts.