After writing my first WordPress plugin (which creates an XML file of your blog using every post’s title, excerpt, permalink and custom fields), I started getting several requests from people who wanted post-specific XML that pulls out images stored in a post’s gallery to populate a Flash gallery.
Since there are several Flash gallery solutions out there that all require different XML structures, I decided to focus on one at a time. First up: Simpleviewer (free version).
SimpleViewer requires JavaScript and the Flash Player.
The Simpleviewer gallery above is populated by a dynamically generated XML file for this particular post. With my new plugin, Post XML for Simpleviewer, every post on my site has its own associated XML file that lists all of the post’s attachments, as well as captions and thumbnails.
After installing and activing the plugin, the XML files are generated simply by visiting a single post in a browser. Basically, the file generates each time someone looks at a specific post (not an index or archive page), so the XML is updating each time a single post is visited. If you get a ton of traffic, this might not be the best solution for you due to potential server overload.
The XML generated for each post will be located in a folder called “SVxmlfiles” within your wp-content folder. Each filename will be galleryXXX.xml where the XXX is your post ID number. For example, the location of the XML for this post is:
http://www.lauragentry.com/wordpress/wp-content/SVxmlfiles/gallery343.xml

You can set your preferences for Simpleviewer parameters by visiting the options page which is located under “Settings” in your dashboard.
I’m making the assumption with this plugin that you’re already familiar with Simpleviewer and are just looking for a way to dynamically generate the content with your WordPress blog.
If you think you’ll want every post to have a Flash gallery, I’d recommend putting the embed code in your template. If not, you can do it within the body of your WordPress post or page.
If you are going to have more than one gallery, you’ll need to give the “flashContent” a unique ID to match your blog post ID. Something like “flashContent343″ would be good for this post. Here’s the embed code I used for the gallery above:
<script type=”text/javascript”>// <![CDATA[
var flashvars = {};
flashvars.galleryURL = "http://www.lauragentry.com/wordpress/wp-content/SVxmlfiles/gallery343.xml";
var params = {};
params.allowscriptaccess = "always";
params.allowfullscreen= "true";
params.bgcolor = "555555";
swfobject.embedSWF("/wordpress/wp-content/uploads/simpleviewer.swf", "flashContent343", "600", "550", "9.0.124", false, flashvars, params);
// ]]></script>
<div id=”flashContent343″>SimpleViewer requires JavaScript and the Flash Player.</div>
THE BASICS
1) Download and install the plugin into your WordPress plugins folder
2) Activate the plugin. You can tell the plugin is working by visiting any of your single posts and then visiting http://www.yoursite.com/wordpress/wp-content/SVxmlfiles/galleryXXX.xml where XXX is the post’s ID.
3) Download and install Simpleviewer (free) somewhere on your site
4) In the Simpleviewer embed code, replace the gallery.xml reference with http://www.yoursite.com/wordpress/wp-content/SVxmlfiles/galleryXXX.xml where XXX is the post’s ID. If you’re placing the embed code in a template rather than a post or page, be sure to have the template dynamically generate that post ID.
THE PROBLEMS
1) There’s no way to exclude a photo from a gallery if it’s one of the post’s attachments. That’s outside the scope of this plugin, as I’m working within the confines of the WordPress gallery feature.
2) It does not currently differentiate between photos and other types of post attachments, so it will attempt to treat documents, videos and images the same. I’ll get that fixed in the near future.
3) As mentioned above, this generates XML on the fly every time someone visits a single post. If you’ve got a lot of images and a lot of traffic, there could be a site performance issue. If anyone experiences this, let me know.
UP NEXT
I plan on tackling Simpleviewer Pro and Autoviewer next. If anybody knows a way to reliably embed Autoviewer into a WordPress post without using iframes, hit me up at its.the.general@gmail.com!