Getting Flickr Photos into Drupal Blog Posts... Quick!

After installing Drupal's QuickTags module and Flickr module I decided to simplify the process of adding an image from Flickr to my blog posts. Here's the result.
As you can see in the image to the left, I've got several Quicktag buttons above my blog-writing textarea. Six of them are for Flickr: each prints tag data for photos of different sizes and CSS alignments.
So, to embed the image, I clicked the one which embeds a medium photo and floats it on the right side. Clicking the button adds the following code to the content-writing textarea:
<div class="flickr_medium_right">[flickr-photo:id=INSERTVALUE,size=m] <p class="caption">[flickr-credit:id=INSERTVALUE]</p></div>
Getting the photo ID from Flickr is simple: just grab the last number in the URL.
Unfortunately, it does take a little more work than that. Did you notice the two all-caps words, "INSERTVALUE?" Those need to be replaced with the ID of the Flickr photo you want to embed.
Finding the ID of an image on Flickr is super-easy. Just navigate to the image you want to embed—making sure the license allows you to copy the image—and highlight the last string of digits in the URL. Ctrl+C.
After pasting the ID into the little chunk of code we get this:
<div class="flickr_medium_right">[flickr-photo:id=255527823,size=m] <p class="caption">[flickr-credit:id=255527823]</p></div>
And that's all it takes! You can write a caption before the photo-credit if you like, or just leave it blank.
I've compiled a module-of-sorts if you'd like this functionality on your blog. I'm quite new to the inner workings of Drupal so you'll have to copy and paste some CSS and PHP code into your theme to get this to work.
Delicious
Digg
Reddit
Facebook
Google
Yahoo
Technorati

Comments
Post new comment