Textpattern & SimpleViewer

I advocate open source efforts on the web, and I love free software. Whenever I get a chance, I try to vote my dollar and support grassroots efforts, opting to donate money rather than buy expensive packages. The reason for this is two-fold. First, I am cheap and usually like to try something to see if I like it. Secondly, I love the potential that altruistic collaboration has for usurping big businesses, such as Firefox vs. Internet Explorer.

This article is about getting the open source CMS Textpattern working with the freeware photo system SimpleViewer. Last November, I made my wife her very own website, which includes a blog and photo gallery. Ever since we launched her site, I have been getting requests for a tutorial on how I got these two systems working together. I apologize for the lateness. Here it is…

Step 1: SimpleViewer

I am assuming that you are already somewhat adept at setting up Textpattern, and that you are familiar with various web technologies such as PHP and XML. If you haven't already, go and download SimpleViewer. While it is possible to disperse the files, and change the image locations via imagePath and thumbPath in the PHP / XML files, I have opted to keep all the files within a self-contained directory, /fotos/.

Basically, I have made an index.html page that is identical to the rest of the site templates, which are managed via TXP. This allows me to keep all relevant files grouped together. This is necessary, because despite being able to change the image directories, you cannot edit the location of the XML file relative to the SWF viewer, apart from purchasing the source code.

Upload your photo gallery directory via FTP. You should have these files…

  • /assets/images/ - set to 755
  • /thumbs/ - set to 755
  • viewer.swf
  • index.html
  • buildgallery.php
  • imageData.xml

Step 2: Textpattern

In the Textpattern interface, go to Admin › Preferences › Advanced, and change your Image Directory to the location of your SimpleViewer images folder. In the case of my wife's site, this directory is "fotos/images". This way, when you upload photos via Content › Images, they will automatically be ready for inclusion in your gallery.

Step 3: Build Gallery

Each time additional photos are uploaded to the /fotos/assets/images/ directory, you will need to run the /fotos/buildgallery.php script. This will automatically scan the /assets/images/ directory, and re-create the XML file accordingly, as well as save smaller thumbnail images to the /thumbs/ directory. I have made a browser shortcut to the PHP file for my wife.


There you have it, an easy way to create a Textpattern driven SimpleViewer photo gallery. The basic premise could also be used for a PostCard Viewer gallery instead. If you consider yourself a guru, you could probably get both viewers running from within the same root, sharing the /assets/images/ directory. Now, go forth and make beautiful galleries with your newfound knowledge!