2009-07-31

Shorthand for ebmedding Flickr images to post

I post very occasionally because it is a pain to include a bunch of photos from Flickr into post: a lot of copy-paste of urls, titles, making sure about size of photo I'm including URL for, reference URL to photo on Flickr..

I wanted to simplify this process. Searched for a way to make some server-side scripting in blogger, and found nothing except the possibility of executing server-side JavaScript on Google Spreadsheet. Not for Blogger unfortunately.

So I wrote a simple script that searches for span tag with flickrLooukup value in class attribute. This tag should contain a title attribute with value in a form of "photo_id,size_suffix". Than it performs lookup of all information about photo using Flickr API and substitues span with something more useful.

So instead of something like:
<a href="http://www.flickr.com/photos/dusoft/3559295427/"><img src="http://farm4.static.flickr.com/3310/3559295427_2f7e18d87c_m.jpg" border="0" alt="Acer TravelMate 2490" /></a>
Now I need just this:
<span class="flickrLookup" title="3559295427,m"></span>


I've the code inserted right into a template, but if somebody find this useful there are no problems to make widget/gadget out of it.

And to test it(I haven't tested it in anything but Firefox), here are some random photos:

No comments:

Post a Comment