A couple of months ago I added a "photos" feature to EverythingNY where I list the most recently updated blog entries for NY-based photobloggers. I can't speak for my readers, but this has become my favorite thing to do on the site. I quickly scan the titles, and check out the newest images of the city.
But text links only go so far. I really wanted to pull in the actual images (or thumbnails) from the photobloggers. I tried a bunch of different approaches using regular expressions and even writing my own MT plugin, but this was just too much for my amateur coding skills. Then, behold! Someone else did the hard work for me with a great new plugin.
To start, you need to install the MTRecentImages plugin. The
original updated version is available here. This plugin allows you to use an <MTRecentImages> container tag to iterate through your most recent images. I found that I really wanted to also access tags relating to the entries in which these images were found, so I created an extended version of the plugin, available here which Jason quickly updated into the original. If you use the original you will have to remove the <MTRecentImagesEntryUrl> and <MTRecentImagesEntryTitle> tags from the templates below.
In addition to the MTRecentImages plugin, you'll need the MTGrid plugin to create a nice two-column layout. Here's the code:
<table width="577" cellspacing="5" cellpadding="5" border="0"> <MTGrid num_columns="2">
<td align="center" width="50%">
<a href="<MTRecentImageEntryUrl>" title="<$MTRecentImageName$>"><img src="<$MTRecentImageUrl$>" <$MTRecentImageHeight$> <$MTRecentImageWidth$> border="0"></a><br />
<a href="<MTRecentImageEntryUrl>" title="<$MTRecentImageName$>"><$MTRecentImageEntryTitle$></a>
You can change the number of columns, column widths, number of images, etc pretty easily.
Remember the MTRecentImagesEntry... tags only work with the enhanced version of MTRecentImages.
To generate an RSS feed I modified the index.rdf default MT template and added some MTRecentImages tags. Unfortunately, for some reason I couldn't get the template to validate using the standard "encode_url" tag so I had to use a regex hack which requires the MTRegex plugin as well.
Since RSS doesn't have any image-specific tags within the <item> fields, I extended the RSS with height, width, and entrylink fields (e.g. <item:height>). Don't know if this is kosher, but it validates, so that's enough for me. Please, if people who actually know what they are doing read this, don't be shy -- tell me why this is a stupid idea.
The template can be downloaded here.