Generating flic.kr URLs in Javascript

A little snippet of code that might be useful to people. Author is me, public domain (although tbh could I even copyright this? Pretty trivial.)


function base58(i)
{
    var lookup = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
    var s = "";
    while (i > 0) {
        var r = i % 58;
        s = lookup.charAt(r) + s;
        i = (i - r) / 58;
    }    return s;
}

function flickrTiny(i)
{
    return "http://flic.kr/p/" + base58(i);
}
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s