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

Flickr Quicktags for Drupal

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

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.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
If you have a Gravatar account, used to display your avatar.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You can enable syntax highlighting of source code with the following tags: <code>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

About

Daniel McLaren

Daniel is a Flash and Flex developer specializing in the art of information visualization.

Latest from SketchyD

Latest Drawing from SketchyD

This is the most recent drawing from my mobile sketch blog, SketchyD.com.

Recent comments