An easy photolog made easier
2006-08-16: This 2003 info applies to my earlier blog tool, Movable Type, not the current one, Textpattern.
I set up my Movable Type photolog a long while ago following Jeremy’s fine instructions. But as a practical matter I haven’t added to it often because manually calculating heights, widths, and paths is more than I really want to do.
I dimly realized back in December that Brad’s MTEmbedImage plugin could do the calculations and thumbnail creation automatically using ImageMagick, but I’m only just now getting MTEmbedImage woven into Jeremy’s approach. (I could be using newer, presumably more comprehensive approaches like Brandon’s MTPhotoGallery, but I like the simplicity Jeremy’s provides, and I wanted closure on understanding how to use MTEmbedImage.)
I present this as one example of how to put MTEmbedImage to use.
Example: With these template adjustments to Jeremy’s instructions, all I have to do to publish an image is (1) copy it into my appropriate archive directory, (2) create a new photolog entry containing just title, image filename, and optional description, and (3) save. Like so:
Title: Dinner bell, no chihuahua
Entry Body: IMG_1252.jpg
Extended Entry: This is the dinner bell that stood on a pole at my grandparents’ house. It’s part of my earliest memories. Ring, ring, ring, come to dinner! (which in the country means the noontime meal).
You can see this entry’s published result on photolog’s main page (thumbnail is autogenerated) and on photo’s individual archive page.
The result looks exactly the same as before, but now it’s more nearly effortless to achieve.
Key additions to photolog templates:
mtphoto-main-index.tmpl —
<!-- MWJ 20031108: use of MTTagInvoke allows forcing no convert_breaks in -->
<!-- MTEntryBody, which if present breaks MTEmbedImage output; not possible -->
<!-- with standard MTEmbedImage "[MTEntryBody]" syntax -->
<a name="<$MTEntryID pad="1"$>"> href="<$MTEntryLink$>">
<MTTagInvoke tag_name="MTEmbedImage" width="96" thumbsuffix="_tn-96w">
<MTTagAttribute name="basename">archives/images/<MTEntryBody convert_breaks="0"></MTTagAttribute>
<MTTagContent>
<img src="<$MTBlogURL$><MTEmbedImageThumbFilename>"
width="<MTEmbedImageThumbWidth>"
height="<MTEmbedImageThumbHeight>"
alt="<MTEmbedImageThumbFilename> (<MTEmbedImageThumbSize measure="k">k)"
border="0" />
</MTTagContent>
</MTTagInvoke>
</a>
mtphoto-archive-indiv.tmpl (also mtphoto-archive-cat.tmpl and mtphoto-archive-date.tmpl) —
<!-- MWJ 20031108: use of MTTagInvoke allows forcing no convert_breaks in -->
<!-- MTEntryBody, which if present breaks MTEmbedImage output; not possible -->
<!-- with standard MTEmbedImage "[MTEntryBody]" syntax -->
<p>
<MTTagInvoke tag_name="MTEmbedImage">
<MTTagAttribute name="basename">archives/images/<MTEntryBody convert_breaks="0"></MTTagAttribute>
<MTTagContent>
<img src="<$MTBlogURL$><MTEmbedImageFilename>"
width="<MTEmbedImageWidth>"
height="<MTEmbedImageHeight>"
alt="<MTEmbedImageFilename> (<MTEmbedImageSize measure="k">k)"
border="0" />
</MTTagContent>
</MTTagInvoke>
</p>
Because the thumbnail URL is no longer being stored in the database as part of the entry, I can’t use SQL as I’ve been doing to select random photolog thumbnails for display on my main blog’s main page. I have to recalc the thumb URL as on photolog main page:
sb-photoselect.inc —
<!-- MWJ 20031108: Switching from SQL to alternative photolog -->
<!-- retrieval that recalc's thumbnail URL (its URL no longer -->
<!-- present in database) -->
<MTOtherBlog blog_id="2">
<MTRandomEntries lastn="10">
<div class="preview">
<a name="<$MTEntryID pad="1"$>" href="<$MTEntryLink$>" title="<$MTEntryTitle$>">
<MTTagInvoke tag_name="MTEmbedImage" thumbsuffix="_tn-96w">
<MTTagAttribute name="basename">archives/images/<MTEntryBody convert_breaks="0"></MTTagAttribute>
<MTTagContent><img src="<$MTBlogURL$><MTEmbedImageThumbFilename>"
width="<MTEmbedImageThumbWidth>"
height="<MTEmbedImageThumbHeight>"
alt="<MTEmbedImageThumbFilename>
(<MTEmbedImageThumbSize measure="k">k)" border="0" />
</MTTagContent>
</MTTagInvoke>
</a>
</div>
</MTRandomEntries>
</MTOtherBlog>
Result is the random several thumbnails displayed in my main blog’s main page right sidebar.
As I tweak further, my current live photolog templates stay accessible here. (Yes, these hacked-up photolog templates, while functional and valid XHTML 1.0 Transitional, need a good sweeping and deuglification. Soon come.)
Additional Movable Type plugins used <applause, applause>:
- Brad Choate’s MTEmbedImage
- Stepan Riha’s MTTagInvoke
- David Raynes’ MTOtherBlog
- David Raynes’ MTRandomEntries
Related: For easy bulk publishing of images, I’m fond of David Ljung Madison’s command line HTML photo album generator, album (which has nothing to do with Movable Type).
<!— imported into Txp from MT on 2004-12-23 (as orig published on 2003-11-12) —>
<!— May not be relevant in new context —>