Monday, 18 February 2013

Photo gadget for Blogger


Intro
Creating your own photo gadget / widget for a blogspot.com / Blogger blog.

The challenge
I've got a separate blog for photos (here is some info). I'm mainly using flickr for uploading and pushing photos to the blog. However, as well I've set up Instagram to do the same. The challenge is that there was no very neat way to present pictures from my photo blog on main blog (chronicles.no, this blog). Hence I ended up having to make something myself. Here is how it was done.

What you need
To do this yourself you would need a server where you can run a small program. I ended up developing in Perl. It might be possible to do the exact thing just using JavaScript rendering on the fly, but I never got that far.

The program
The program below parses the RSS feed for my picture blog and outputs a HMTL file using the Blogger gadget format.
--

--

Cron
The program has been added to cron and runs once every 5 min:
*/5 * * * * /usr/bin/perl /home/klevstul/www/klevstulCom/scripts/kThumb/kThumb.pl; date >> /home/klevstul/www/klevstulCom/scripts/kThumb/crontab.log

The gadget
The output file became a Blogger gadget that I added to my blog.

Adding your own gadget.

kThumb picture gadget

The gadget presented below the banner and above the posts.

The final result.

No comments:

Post a Comment

Allowed HTML tags:
<b>bold</b>
<strong>strong</strong>
<i>italics</i>
<em>emphasis</em>
<a href="">hyperlink</a>


Please, show the courtesy of identifying yourself when adding a comment. Anonymous comments will, most likely, be removed.