FlickrPhotos - A Flickr Plugin for Movable Type

Keep track of this discussion by subscribing to the RSS feed for this discussion thread
Author Message

PostPosted: February 3, 2006 1:28 PM 

Flickr photos is a plugin that enables you to display thumbnail links of Flickr photos in your Movable Type blog.

You can list thumbnails by Filckr user and/or by Flickr tags. You can also control the number of thumbnails displayed and the size of the thumbnails. Each thumbnail can link to a larger version of the image, or to the Flickr page for that photo.

Here is an example of the easiest way to use FlickrPhotos in your templates:

<MTFlickrPhotos username="John Smith">
<MTFlickrPhotoLink> <br />
<br />

The above template code will display thumbnail links for the 10 most recent photos for Flickr user "John Smith". (Tip: when entering the value for your 'username', you should use the name that appears after "Logged in as" on the top of each Flick page when you are logged in. Your user name may contain spaces - if so, be sure to include those space as I have done with "John Smith" above).

Here another example that displays thumbnail links from any user tagged with "movabletype":

<MTFlickrPhotos tags="movabletype">
<MTFlickrPhotoLink> <br />
<br />

FlickrPhotos Template Tags

FlickrPhotos includes the following template tags:

  • MTFlickrPhotos is container tag for displaying photos. Arguments include:
    • username - restricts photos to a specific Flickr user. Required if a tags argument is not included.
    • tags - retricts photos to those with the specified tags. Multiple tags can be specified, separated by comma. Required if a username argument is not included.
    • tag_mode - specifies the method for displaying photos by the tags argument. If tag_mode is set to 'any', it will display photos with at least one on the tags specified in tags. If tag_mode is set to 'all', it will only display photos tagged with each and every one of the tags specified by tags. Optional (the default value is 'any').
    • lastn - determines the number of photos to display. Optional (default is 10 photos).
    Example tag with all arguments included: <MTFlickrPhotos username="John Smith" tags="movabletype,hacks" tag_mode="all" lastn="5">
  • MTFlickrPhotoThumb outputs the URL to the thumbnail image. The size of thumbnail is determined by the FlickrPhotos plugin settings (see below). Example usage: <img src="<MTFlickrPhotoThumb>">
  • MTFlickrPhotoURL outputs the destination URL that can be used to link each thumbnail. This URL will be to either to the Flickr photo page or directly to a different size of the photo (as determined by the plugin settings). Example usage: <a href="<MTFlickrPhotoURL>">
  • MTFlickrPhotoTitle outputs the Flickr title for the photo. This can be used as "alt" text for the thumbnails, and/or used a caption for each photo.
  • MTFlickrPhotoLInk combined each of the above tags - it outputs a linked thumbnail, using the title as the 'alt' and 'title' for the link. The link will open in a new window. This tag is the easiest way to use FlickrPhotos, becuase you don't have to write any HTML for creating the link or displaying the image.

FlickrPhotos Plugin Settings

There are two settings which you can set on a pe-blog basis. To access these settings, select the blog you want and then choose "Settings" from the menu. Then choose the "Plugins" tab. You should then see FlickrPhotos in the list of plugins - hit the settings link to display the settings. The two settings are:

  • Thumbnail Size: This setting determines the size of the thumbnail images. Choice are Square, Thumbnail, Small, Medium, and Orginal. These sizes correspond to the sizes used by Flickr. The default is Thumbnail.
  • Link to: This setting determines where each thumbnail will link to. You can link directly to a different size of the photo (you can choose from the same sizes as above) OR you can link each photo to the Flickr page for that photo. The default is Flickr Page.


  • MT 3.2 (it may work with earlier versions, but I have not tried)
  • Flickr::API Perl Module (included in download for convenience)
  • XML:: Parser::Lite and XML:: Parser::Lite::Tree (included for convenience)


  1. Download the plugin by clicking here.
  2. Expand the zip file and upload the contents of the 'plugins' folder to the 'plugins' directory of your MT installation and the contents of the 'extlib' folder to the 'extlib' folder of your MT installation.
  3. Adjust the plugun settings if desired (see above)
  4. Start using the above template tags in your templates.

As always, please let me know if you find any bugs, or if you have any suggestions or comments.


Posts: 1

Reply: 1

PostPosted: April 10, 2006 5:52 AM 

dfsdf sdfsdf http://sdfsdf.com

Annoying Old Guy

Posts: 4

Reply: 2

PostPosted: April 24, 2006 12:03 AM 

If I hacked your hack to provide size information, would you be willing to consider back patching that in? The application I have in mind for this requires the pixel sizes of the images.

P.S. You have two copies of FlickrPhotos.pl in the distribution.

P.P.S. In terms of code structure, I have a whole bunch of comments. Heh.

* Why do you repeat the API key in multiple places instead of 'use constant' or even an 'our' variable?

* You should look at moving most of the code to an ancillary file that loaded only if the plugin is used, instead of loading that big chunk 'o code every time anything is done in MT. Look at AutoBan for an example of how to do that.


Posts: 33

Reply: 3

PostPosted: April 24, 2006 10:20 AM 

Thanks for the comments, AOG.

Yes, if you want to add a pixel dimensions feature, I would definitely add that in. Thanks.

Regarding having 3 copies of FlickrPhotos.pl -- thanks for letting me know, I will look into that right away.

Regarding the API key, the answer is laziness Embarassed mostly. I know that I really should do that.

I will try to implement your last suggestion too. The general answer to these questions is that I am quite a novice when it comes to programming. When I do things like this, much time is spent, digging for tutorial content to try to figure out how to achieve what I want. I am sure there are more than a few best practices that I am not following Wink

Annoying Old Guy

Posts: 4

Reply: 4

PostPosted: April 24, 2006 12:41 PM 

Well, I already have a working copy, if you'd like to see it Wink . I'll mail you a copy, along with some other commentary.


Posts: 1

Reply: 5

PostPosted: August 3, 2006 10:07 PM 

This is fantastic - thanks for creating it. Smile

Any way to grab random photos instead of the last picture uploaded?

Kelly [TypeKey Profile Page]

Posts: 1

Reply: 6

PostPosted: August 10, 2006 7:14 AM 


I am mere novice with Moveable Type but I do know that it's a fantastic creation.

I use it for RSS mostly and want to include images along side my news feed.

I have successfully installed flickr but I just don't know how to use it. Can anybody help me out here.

Best regards

Kelly Sad

Subscribe to this discussion: Email | RSS

Join the conversation:

Remember personal info?

Very Happy Smile Sad Surprised
Shocked Confused Cool Laughing
Mad Razz Embarassed Crying or Very Sad
Evil or Very Mad Twisted Evil Rolling Eyes Wink
Powered by MTSmileys
Check to Subscribe to this Comment:
(email field must be filled in)

Subscribe Without Commenting

Creative Commons License
This weblog is licensed under a Creative Commons License.