Photo Gallery Templates

Get the Files

v1.0.4: 19 Oct 2005 Release Notes

Download .zip 888 KB (Win)

Download .tar.gz 944 KB (Mac/Linux)


Donate via PayPal. Suggested donation of US$25 for use of design and/or templates. Your support is greatly appreciated! Read more.


These Photo Gallery Templates are provided for anyone who wants to automate publishing of their own well-designed photo galleries. The templates were originally designed, developed, and iterated by Douglas Bowman of Stopdesign for his personal galleries. These templates are used for publishing all gallery pages hosted there.

This package includes templates for producing the following page types: Gallery Index, Gallery Archive, Gallery Title, Photo Gallery, Individual Photo, Recent Comments, and a base set of Comment Pages. Also includes templates for RSS 2.0 feeds of Recent Galleries, Recent Photos, Recent Comments, and Photos by Gallery. Package includes all style sheets, image files, scripts, and template code needed to reproduce Bowman’s gallery design.

License & Terms

Creative Commons License: Some Rights Reserved

This gallery design and set of template files that recreate it are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. You’re free to download, use, modify, and repurpose these templates in any way you wish, as long as they’re not used, bartered, or sold for commercial purposes. If you redistribute any work, you must release it under the same license. Please include credit to the original designer/author (Stopdesign), and include a visible link back to the original download and documentation page.

Templates and files are provided “as-is”, without warranty of any kind, and without guarantee of support or future updates.

Stopdesign and Douglas Bowman are not liable or responsible for any content published using these templates, nor are they liable or responsible for any illegal activity, damage, slander, or negligence caused by or the result of using or publishing content with these templates or any related variations created by other entities. By downloading and/or using the template package, you automatically accept the license and these terms and conditions.


  • Add descriptions to each photo.
  • Tag each photo with a keyword that shows up on a slide frame in gallery view.
  • Group photos into galleries by assigning categories in MT.
  • Mark any number of photos from different galleries as “favorites” which also show up in their own Favorites gallery.
  • Navigate photos by using previous/next thumbnail previews, or by clicking on a left/right half of the current photo.
  • Assign a description, unique title, and custom style sheet for each gallery.
  • Allow visitors to browse photos with inline comments shown or hidden.
  • Show comment form only when requested.
  • Enable comments for any photo.
  • Allow visitors to limit number of photos per page.
  • Allow visitors to reverse the order of thumbnails on gallery pages.
  • Generate gallery title images automatically, or create custom title images.
  • Designate galleries as “hidden”, preventing them from showing up on Index pages and in feeds.
  • Access global pages and feeds via summary data on the Gallery Index.
  • Subscribe to Recent Galleries, Photos, and/or Comments via global RSS feeds.
  • Subscribe to updates for a single gallery via RSS feeds for each gallery.


These templates currently require Movable Type version 3 or higher, and support on your server for PHP.

The templates assume data for each photo exists as its own entry, with data belonging in specific fields. The perfect combination of tools for Mac users is Apple’s iPhoto and the iPhoto export plugin, Photon. Photon enables automatic creation and upload of images and thumbnails, plus configurable export of all photo data directly to MT.

The style sheet provided with these templates assumes a default 4:3 (or 3:4) ratio for all photos. If your camera shoots at 1024x768, 1600x1200, 2272x1704, or some other equivalent 4:3 ratio, you’ll be fine. The included style sheet supports 480x360 (landscape) or 360x480 (portrait) for regular-size images, and 90x68 or 68x90 for thumbnail-size images. Other ratios or sizes require changes to style sheet values.

Required MT Plugins

Name 6A Developer Use
Arithmetic Info Info/Download Setting variables with other MT tags as values, and incrementing variables
Category Info Info/Download Allows access to category archive tags from individual entries
CategoryOfArchive Info Info/Download Used on gallery pages to access data in the Category Description field, and other category tags
Collate Info Info/Download Grab latest entries from each category, then sort categories by most-recently-updated
Collect Info Info/Download Collect width and height attributes of <img> to determine orientation
Compare Info Info/Download Used programmatically for if/then statements and general comparisons
DirifyPlus Info Info/Download More advanced options for auto-dirifying, including use of dashes instead of underscores
Entry Info Info/Download Singles out one entry ID to use that entry’s image for Index and Title pages

Note: Only needed if using the “auto” versions of Gallery Index and Gallery Archive templates.

Expressions Info Info/Download Required by Arithmetic plugin

Note: Pay attention when installing, as this goes in a different location than other plugins.

FilterCategories Info Info/Download Used to exclude “Favorites” category from index/archive pages
FirstNWords Info Info/Download Summaries of Most Recent Galleries on index page
Grid Info Info/Download Group index and archive listings by threes
KeyValues Info Info/Download Meta data for each gallery (category description field)

Note: Pay attention when installing, as one file goes one place, the other goes another place.

Note: These templates do not require the “regex” plugin Brad mentions might be required on his page.

PreviousNextInCategory Info Info/Download Ability to go forward or backward within the same gallery (category)
RelativeURL Info Info/Download Eliminate host/domain from certain file paths

Optional MT Plugins (recommended)

Name 6A Developer Use
SmartyPants Info Info/Download Typographically correct curly quotes, em-dashes, and ellipses

Why: Appropriate punctuation is better than ASCII equivalents.

MT Settings

The following instructions are provided as MT 3.2+ now arranges the settings. If you’re using MT 3.0 or 3.1, most of these settings are still present distributed within the Weblog Config section under Core Setup, Preferences, and Archive Files.

Note: Only important settings or those different from the defaults are specified below.


  • Weblog Name: Make sure you enter something here. The name is used throughout the templates.
  • Description: Enter something here if you want a custom Description to appear on the Gallery Index page.
  • Entry Order: Ascending
  • Comment Order: Ascending

New Entry Defaults

  • Text formatting: None

Feedback (Comments)

  • Your own choices here

    Note: I don’t use TypeKey Authentication, so commenting may not work correctly with TypeKey enabled. If you choose to use TypeKey, you’ll need to modify the comment templates, Individual Photo template, and Comment Field template module. I also don’t use Trackback, and especially don’t see much value in it for photo galleries. So no allowances for trackbacks appear in the templates.


  • Site URL: [URL of photos directory]
  • Site Root: [full server path to your photos root directory]
  • Advanced Archive Publishing: leave unchecked

    Note: If you need to use different values for Site and Archive paths, see the FAQs.

  • Preferred Archive Type: Individual
  • File Extension for Archive Files: php
  • Dynamic Publishing: Build all templates statically

Upload template files

“Photos root” below refers to the same directory on your server that you specify under Settings or Weblog Config.

  1. Download and unzip template package.
  2. Upload entire directory meta to photos root.
  3. Create new directory comments in photos root.
  4. Create new directory galleries in photos root.

Adding Templates to MT

You need to decide if you want the title image to be AUTO-CREATED, or if you would like to MANUALLY CREATE them yourself. If AUTO-CREATED, the title image will be determined either by the most recent image from that gallery, or by your choosing. If you have title images AUTO-CREATED, the Gallery Index and Gallery Title pages will look similar to the following:

Alternatively, you can choose to MANUALLY CREATE each title image to match (in size) what is visible on these pages:

Index Templates

  1. Delete default Dynamic Site Bootstrapper
  2. Delete default Main Index
  3. Delete default Master Archive Index
  4. Delete default RSS 2.0 Index
  5. Delete default Site JavaScript (MT 3.2+ only)
  6. Delete default Stylesheet

Create new Index Templates with the following values:

Template Name Output File Link to file
Gallery Index index.php AUTO-CREATED title images:
MANUALLY-CREATED title images:
Gallery Archive galleries/index.php AUTO-CREATED title images:
MANUALLY-CREATED title images:
Recent Comments comments/index.php meta/templates/general-php/t_comments.php
RSS: Comments comments/comments.xml meta/templates/rss/t_rss_comments.xml
RSS: Galleries galleries/galleries.xml meta/templates/rss/t_rss_galleries.xml
RSS: Photos index.xml meta/templates/rss/t_rss_photos.xml

Archive Templates

  1. Delete default Category Archive
  2. Delete default Date-Based Archive
  3. Delete default Individual Entry Archive

Create new Archive Templates with the following values:

Template Name Link to file
Gallery Info meta/templates/general-php/t_galleryinfo.php
Gallery Title AUTO-CREATED title images:
MANUALLY-CREATED title images:
Individual Photo meta/templates/general-php/t_photo.php
Photo Gallery meta/templates/general-php/t_gallery.php
RSS: Photos by Gallery meta/templates/rss/t_rss_bygallery.xml

System Templates (Special):

Edit these System Templates using the following values:

Template Name Action Link to file
Comment Preview Template Delete contents of Template Body meta/templates/system/t_comment_preview.html
Comment Error Template Delete contents of Template Body meta/templates/system/t_comment_error.html
Comment Pending Template Delete contents of Template Body meta/templates/system/t_comment_pending.html

Note: TrackBack Listing, Upload Image Popup, and Dynamic Pages Error Templates not included.

Template Modules

  1. Delete default Remember Me (MT 3.0 - 3.1 only)

Create new Template Modules with the following values:

Template Name Link to file
Comment Fields meta/templates/modules/mod_comment_fields.html
Footer meta/templates/modules/mod_footer.html

Template Configuration

This section explains how to configure MT to publish specific gallery templates at certain URLs. MT calls this Archive Mapping. Modify the following by going to back into Settings > Publishing, then scroll down to “Archive Mapping”.

Publishing: Archive Mapping

  • Create New Archive Mapping Individual with template Individual Photo
  • Create New Archive Mapping Category with template Gallery Info
  • Create New Archive Mapping Category with template Gallery Title
  • Create New Archive Mapping Category with template Photo Gallery
  • Create New Archive Mapping Category with template RSS: Photos by Gallery
  • Select Photo Gallery as preferred template for category archives
  • Save changes
  • Add Custom Archive File Path for Individual Photo:
    <$MTEntryCategory dirifyplus="pld"$>/gallery/<$MTEntryTitle dirifyplus="pld"$>.php
  • Add Custom Archive File Path for Gallery Info:
    <$MTArchiveTitle dirifyplus="pld"$>/galleryinfo.php
  • Add Custom Archive File Path for Gallery Title:
    <MTIfEqual a="[MTArchiveTitle]" b="Favorites">favorites/title.php<MTElse><$MTArchiveTitle dirifyplus="pld"$>/index.php</MTElse></MTIfEqual>
  • Add Custom Archive File Path for Photo Gallery:
    <MTIfEqual a="[MTArchiveTitle]" b="Favorites">favorites/index.php<MTElse><$MTArchiveTitle dirifyplus="pld"$>/gallery/index.php</MTElse></MTIfEqual>
  • Add Custom Archive File Path for RSS: Photos by Gallery:
    <$MTArchiveTitle dirifyplus="pld"$>/index.xml
  • Save changes

iPhoto: Grouping & Labeling Photos

The easiest way to group photos in preparation for export is to create a new album. Add the photos you want in a new gallery to that album. If you want simple meta information about each photo, add a title and a description.

You can also “tag” photos by adding keywords to them. For iPhoto 5, add keywords within Preferences. Apply keywords to individual photos or a group of photos by using “Get Info”. Keywords will be applied as class values to the list item element, styling each slide with a tiny graphical label. For galleries at, labels are used to indicate the general location where the photo was taken. You can use them for whatever you want or not at all.

Keep in mind, to apply styles to a single class value, the value needs to be one word, or it needs to be hyphenated. So “San Francisco” either needs to be SanFrancisco or San-Francisco if you want to apply styling to the class value as one unit.

A set of label images, based on those needed at are provided and stored in meta/labels/. A standard horizontal image file and a vertical image file exists for each label. The Photoshop file used for creating extra labels can be found in the art/ folder. The font used is “Silkscreen”, by Jason Kottke:

Any new label images you create also need corresponding CSS rules in meta/css/labels.css. Follow the same format that already exists, ensuring the new CSS selectors are lower-case versions of the new Keywords you’re using in iPhoto.

Photon Setup

Once Photon is installed correctly, it should be available as a new tab named “Weblog” under iPhoto’s Export Photos dialog box. Click “Settings” to create a new weblog, and enter everything requested under the Account Information tab. If you need help with any of the fields, refer to the Photon FAQ

If you’re using MT 3.2+, there’s a new API Password on your own Author screen that needs to have a value. Use this for your password in Photon instead of your standard MT login password.

Entry Creation Tab

The templates require photo data in specific places. Use these export equivalents:

iPhotoMT field
titleentry title
photoentry body
thumbnailextended entry
commentsentry excerpt
titleTITLE attribute

I don’t recommend deviating from these requirements. If you do, you’ll need to modify every template and archive mapping significantly to account for your changes.

x Check the box for Use iPhoto time stamp for entry date & time to set the date/time in MT the same as it is in iPhoto. Otherwise, the date/time will be entered as the time you exported each photo.

Image Upload Tab

The style sheet provided with these templates requires specific sizes for photos and thumbnails.

Photos max height480
Photos max width480
Upload pathyour choice (relative to your Site URL directory)
Thumbnails max height90
Thumbnails max width90
Upload pathyour choice (relative to your Site URL directory)

x Check the box for Append “thumbnail” to file name if you chose the same upload paths above for both photos and thumbnails.

Note: For the three radio buttons that determine how to derive the uploaded image name, from experience with all three, I recommend the Use time stamp option. Using the time stamp names the uploaded image with a time that goes all the way to the second. Unless you’re shooting burst images faster than one-per-second, this will guarantee that none of your image files ever get overwritten by accidentally uploading a file with the same name. Both Use original file name and Use title create the potential of uploading files with the same name, causing one to overwrite the other (for example: IMG_9016.jpg and another image that’s also named IMG_9016.jpg, or an image you’ve titled “Hotel” in one gallery, then a month later, you title another image in a different gallery “Hotel”).

Export Photos (Weblog tab):

Once your weblog settings are saved, they’re available under the Weblog pulldown back on the Export Photos pane. Photon will automatically communicate with your MT install and grab all your existing category names. Categories are used to group photos into galleries.

Unfortunately, the “New” button to create a new category has never worked for me. I need to create the category in MT first. Then return to iPhoto/Photon and select that new category. To refresh the category list without quitting iPhoto, just reselect the same Weblog in the Weblog pulldown above, and the category list will automatically refresh.

Entry API

If you’re not using Photon to export entries to Movable Type, you can still use these templates. You’ll just need some other means of getting your photos to the server and your data into MT. You’ll need to know the type of data for each entry, and where it belongs in MT. Use the following as a guide for where to place data in MT, and how it should be formatted.

Note: If you’re using Photon to export photos from iPhoto, you don’t need to worry about this section. Configure Photon as specified above, and your data will end up in the right places.

MT Field Data
MTEntryTitle [Full title of photo]
MTEntryDate [Date photo was taken]
MTEntryCategory [Gallery to which photo belongs]
MTEntryBody <img alt="[title of photo]" title="[title of photo]" src="[full URL to normal-size photo, including domain name]" width="480" height="360" />
MTEntryMore <img alt="[title of photo]" title="[title of photo]" src="[full URL to thumbnail-size photo, including domain name]" width="90" height="68" />
MTEntryExcerpt [Optional text for description or caption of photo]
MTEntryKeywords [Optional keyword(s) indicating some other classification, like location or group]

MT Categories (Galleries)

The templates use MT’s categories to group photos into galleries. The only means of adding additional meta data (description, longer title, custom css, etc.) to a Category in MT is to use the Category Description field. The templates take advantage of Brad Choate’s KeyValues plugin to break this field into multiple separately-accessible chunks.

Meta data is assigned by declaring a VALUE, labeled with a corresponding KEY. They work exactly like any of MT’s entry fields and corresponding field titles. Each key/value pair is defined on its own line, starting with the key name, followed by an equals sign (=), then the key value, with no spaces on either side of the equals sign, and no quotes around the value. For example:


If you want a description for a particular gallery, type the text as normal into the Category Description field. If you have additional Key/Values you want to add — they’re all optional — just make sure you start each Key/Value pair on its own line below the gallery description.

Key Names Available

The optional key names the templates accept include the following:

title=[Any word, phrase, or set of words]
Displays a longer title than the name assigned to this Category. The Category name is always used to determine the path under which galleries are published. But the “title” key can be used to display any title you want for that gallery. So the Category name can be kept short to keep the URLs shorter, but the full gallery title can be anything you want it to be. For instance, I have a gallery that is identified with the category name, nz04, thus it lives under a nz04/ directory. But the Category Description field for this category also contains:
title=10 Days in New Zealand
… which is used for the official gallery title on all published pages for that gallery.
css=[path to custom CSS file]
Assign a custom style sheet for this gallery only. The path is relative to this gallery’s directory. The style sheet can be used to override settings such as background colors or type settings on a per gallery basis. The value should be the path to any CSS file, relative to the directory to which this gallery’s title page is published. When this Key/Value is present, a new <link> element pointing to the custom style sheet is created under the original link to the main style sheet for each page of this gallery. For instance:
… assumes a file named “custom.css” resides in the same directory as the gallery’s title page. Creation and upload of any custom style sheets are up to you.
imgh=[number value]
Only used if you’ve chosen MANUALLY-CREATED title image templates. Used to override the default image height (334px) on the Gallery Title page. Use this Key/Value to assign an img height value other than the default.
imgw=[number value]
Only used if you’ve chosen MANUALLY-CREATED title image templates. Used to override the default image width (733px) on the Gallery Title page. Use this Key/Value to assign an img width value other than the default.
titleimgid=[entry ID, numerical]
Only used if you’ve chosen AUTO-CREATED title image templates. Use this to specify a photo’s Entry ID to be used for this gallery’s title image. Without this key value, the default behavior is to use the most recent photo from this gallery.
Used to prevent this gallery from showing up on any index templates, including the Gallery Index, Gallery Archive, and all global RSS feeds. Useful for having some galleries you only share via email among friends or family — they must know the URL to see any hidden gallery. Any number of galleries can be marked as hidden. See important note in the FAQs about security.


To begin identifying certain images as Favorites, first, create a new category in MT named “Favorites”. Then add “Favorites” as a secondary category to any photo entry you want to identify as a Favorite. The most recent Favorite photos will show up by default on the Gallery Index, with a link to a special gallery containing all Favorite photos.

“Favorites” should never be assigned as an entry’s primary category. Rather, entries should already be assigned to another primary category. The Favorite category has no Gallery Title page.


MT Setup

Can I set different locations for my site and archive URLs in Core Setup?
Yes, if you’d really like to. With this option, it’s important to use an Archive Path that points to the same directory used to publish the Gallery Archive template (“galleries”). This prevents revealing the default directory listing of your Archive directory, and by extension, prevents revealing the location of any galleries you’ve marked as “hidden”. Thus, if your Site Path/Root is /home/username/ and your Site URL is, you’ll probably want to make your Archive Path/Root /home/username/ and your Archive URL


The design and supporting templates are provided for anyone to use, free of charge, according to the terms of the Creative Commons License specified. However, I would really appreciate a donation if you find the design and/or templates useful. I suggest a donation of US$25. Donations help cover the cost of many hours that went into design and creation of these templates, and adding in features that I thought others would appreciate. Donations may also help fund future template creations. Your support is greatly appreciated. Many thanks!
Can I enable dynamic publishing for these templates?
As far as I’m aware, these templates all need to be built with Static publishing because of the static-based plugins they require. Dynamic publishing should NOT be enabled.
Why am I getting a permissions error when attempting to create or save any of these templates?
You might not be running MT under cgiwrap or suexec. That’s ok. In this case try setting permissions of 777 for everything on the server within meta/templates/. Then go back and try to create/save the same template.
Are there templates for feeds other than RSS 2.0?
“Atom Index” and “RSS 1.0 Index” templates are not provided. You’ll need to customize them on your own if you want to provide either feed. If you choose not to provide either feed, you’ll probably want to disable automatic rebuilding of these two templates — or better yet, delete them entirely — in order to speed full-site rebuilds and avoid revealing photos from hidden galleries in your feeds.
If I’m AUTO-CREATING title images, can I choose a specific photo to be used for that gallery’s title image?
Yes. You need to know the MTEntryID for that image. In the Category Description field, use the titleimgid Key Value, and set it equal to the Entry ID of the photo you want to use. This will override the normal AUTO-CREATION of title images, using the photo you chose instead of the most recent photo from that gallery. The Entry ID for each photo is in a comment just below the footer on the Individual Photo page.
How do I change text in the Footer of every page?
In Movable Type, navigate to Templates > Modules. Click on the Footer template module. Edit to whatever you want to appear here. Save.
How do I change the Description text that appears on the Gallery Index?
The description is taken from the MTBlogDescription field. In MT 3.2 or higher, this field is under Settings > General. In MT 3.0 - 3.1, it’s under Weblog Config > Preferences.


By declaring a gallery as hidden, will this completely prevent access by people I want to keep out?
No, this does not actually protect this gallery from being accessed. It’s only a security through obscurity option. A hidden gallery still exists like any other gallery, but visitors will need to know what the exact URL of the hidden gallery is, since it won’t be linked from anywhere else within the gallery system. If you want more protection for any gallery, you’ll need to configure according to whatever additional server security options are available to you.

Note: If you deviate from the recommended settings for Site and Archive paths/URLs (as the same location) and you don’t use an Archive Path that points to the same location as the directory where the Gallery Archive is published, you risk exposing those galleries to anyone who manually views your archive URL. Additionally, you could expose those galleries if you add any extra Feed templates, or change the existing Feed templates, without paying attention to the means with which the existing Feed templates are created.

Can I eliminate the Gallery Title page and link straight to the gallery of thumbnails?
Yes. This change would require altering the Archive File Template path for the Photo Gallery and Individual Photo templates to publish them one level higher. It would also require a few changes to those templates, so that the breadcrumbs in the <p id="path"> area point back up to appropriate pages.
If I’m MANUALLY CREATING title images, where do I put them?
Save all the large title images as title_img.gif, and the small title images as title_img_sm.gif. Create an img/ directory in the same location where the Gallery Title page is published for that gallery, and place both images for that gallery in the img/ directory. For example, my Vancouver gallery was assigned a category in MT named “Vancouver03”, which results in the Gallery Title page published to vancouver03/ relative to the Archive URL (usually same as Site URL) I specified in MT’s weblog settings. So the large and small title images sit in the vancouver03/img/ directory.


I have several keywords on one photo. They all show up on the Individual Photo page, but only one graphical label shows up on the Photo Gallery page. Why?
First, from a design view, there’s no more room to add multiple labels on the Photo Gallery page. Second, from a CSS view, anything in the Keywords field gets added as one single class for each photo’s <li>. Since each keyword is a class at the same level, each successive class value overrides the preceding value. So whatever keyword is last will be the keyword that affects the pseudo-slide image. If you want to ensure one particular keyword shows up on that slide on the Photo Gallery page, just make sure it’s the last keyword in the group for that photo.


What radio button option is best to select on the Image Upload tab?
This button determines how your new image files will be named when they’re exported to the server. I’ve found that using the time stamp for each file works best for me. This prevents overwriting should I ever export an image with the same title or original file name. Time stamp file names go down to the second. So it would be very rare to ever overwrite another image, unless you’re uploading a set of multiple burst photos.
What do I use for the Upload path on the Image Upload tab?
Upload path is relative to the Site URL you entered under MT Setup. For example, if you want all your image files to be stored at and your Site URL is, enter files/ for the Upload path.
I entered 90 for the thumbnail max width and height, so why are some of my thumbnail images getting published as 89x67 instead of 90x68?
Good question. I assume there’s a small bug in the way either Photon or iPhoto reduces photos, thus the measurements aren’t quite right. Don’t worry though — one pixel off won’t affect your gallery pages in a negative way.