I love the Flickr Flash Badges, but the content of the iframe that you have to put on your page is not valid XHTML. That just won’t do. So I decided to take matters into my own hands…
While I was investigating the parameters that Flickr’s flash file takes, and figured out how to change the numbers of rows and columns, as well as the size of the images in the badge.
With a little PHP tinkering, a plug-in was born!
- Simple widget interface
- Easily set up to use whatever Flickr account you wish
- Easily change the size of the thumbnails
- Easily define the number of rows and columns
- Easily limit your pictures by Flickr tags
- Choose between two transitions:
- Big Then Small
- A Flickr Account
- A WordPress Blog
- This is a “Sidebar Widget”, so you must have the Automattic Widget Plugin installed.
- Download the plugin here: flickr-flash-badge-widget.1.1.zip
- Unzip the plugin into your /wp-content/plugins directory.
- Activate the plugin in your WordPress admin.
- Enter your Flickr account details into the widget settings on the Sidebar Widgets page in your WordPress admin (see screenshot).
- Drag the widget onto the sidebar where you want it on the Sidebar Widgets page in your WordPress admin.
The plugin can be seen in action on the sidebar on the left side of this page.
How can I find my @N00 Flickr ID?
One easy way is to use Big Huge Lab’s Flickr DNA page. Simply enter your username into the box and hit ‘Apply’.
Why was this hard?
Flickr has a magic variable called “magisterLudi” (which seems to be a literary reference) that changes every 24 hours. When you use their default method with the iframe, the content of the iframe contains the current value of the magisterLudi. This prevents you from just pasting the <object> tag to run the flash file on their server and bypassing their iframe. (It will work, but not for more than 24 hours.)
To solve this problem, this plugin goes to fetch the contents of the iframe from Flickr, parses it to get the current magisterLudi value, and uses that to display the flash object directly on your page, thereby avoiding the iframe and bypassing their mechanism intended to force use of their iframe.
A caching mechanism is in place to reduce these server-side calls to Flickr. By default, it will only update the magisterLudi value from Flickr every two minutes. Therefore, for two minutes (after Flickr changes the value) every day the plugin will fail. You may change this value in flickr-badge-widget.php if you wish.
Questions and Comments
You may leave questions and comments on this blog, or email them directly to me at erikwordpressplugins -at- gmail.