Flickr bookmarklets

I originally posted last January about a bookmarklet I threw together to generate the appropriate code for vBulletin that will show and link to an image on Flickr. That code recently broke, with the introduction of a farm ID in the static image URL. This is an updated version of that which uses the old (non-farm) URL. Images uploaded after that change was implemented on Flickr’s servers will get redirected, but should still work. Without further ado, here are the new bookmarklets!

Flickr to vbCode

Additionally, I’ve got a Markdown variation that I hadn’t mentioned:

Flickr to Markdown

The Markdown one is useful for WordPress blogs that use Markdown (like MotoringFile).

And finally, a plain old HTML version:

Flickr to HTML

If you’re unfamiliar with bookmarklets, you can read up about them on Wikipedia

For future reference, the following is the code that does the magic; all you need to do is URL-escape the code and stick it into a “javascript:” URL.

// vbCode
var img = global_photos[page_photo_id];
var imgLoc = <em>photo</em>root.replace("http://farm.", "http://") +
    img.server + "/" + page_photo_id + "_" + img.secret + '.jpg';

var msg = "[url="+ document.location + "][img]" + imgLoc + "[/img][/url]";
prompt("vbCode", msg);

// Markdown
var img = global_photos[page_photo_id];
var imgLoc = <em>photo</em>root.replace("http://farm.", "http://") +
    img.server + "/" + page_photo_id + "_" + img.secret + '.jpg';

var mdImg = '![' + img.title + '](' + imgLoc + ' "'' + img.title&#160;+ '' on Flickr")';
var msg = '[' + mdImg + '](' + document.location + ')';

prompt("Markdown code", msg);

One Response to “Flickr bookmarklets”

  1. [...] I take no credit for this, all I did was edit this existing bookmarklet so that it returned the larger image rather than the smaller one that it returns by default. [...]

Leave a Reply