Discussions (4722)
manufacturing flic.kr style photo URLs
kellan says:
Super quick note, hopefully sufficient info.
Originally posted at 9:42AM, 13 April 2009 PST (permalink) kellan edited this topic ages ago. |
blech says:
Thank you. I was trying to reverse engineer the base58 string, and getting close, but no cigar. (If the photo ID space wasn't quite so sparsely populated where I was sampling it, I might have managed, too.)
|
|
alto maltés says:
Cool.
|
|
matt says:
Someone jam this in a twitter client, pronto!
|
|
Eli the Bearded says:
BC math is available in PHP. |
|
Richard Cunningham says:
It would be good if this was translatable to a photo url with out any requests (in the way twitpic, twitgoo, yfrog etc. do). |
|
polite popcorn [deleted] says:
Here's an implementation of the encoding part in Objective-C: gist.github.com/101674
|
|
Jiayong Ou says:
And here's an implementation in Ruby: |
|
faygate says:
C# example: |
|
⁂※⌘ says:
An example for a bookmarklet: javascript:void(prompt('Flic.kr short ID (base58)',(function(num){if(typeof num!=='number')num=parseInt(num);var enc='', alpha='123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'; var div=num,mod;while(num>=58){div=num/58;mod=num-(58*Math.floor(div));enc=''+alpha.substr(mod,1) +enc;num=Math.floor(div);} return(div)?''+alpha.substr(div,1)+enc:enc;})(prompt('Flickr picture ID')))) ETA: A more useful variant, giving you the respective Flic.kr-URL, if activated on a photo display page, might be:
Originally posted ages ago. (permalink) dopiaza (a group admin) edited this topic ages ago. |
|
stevefaeembra says:
quick python snippet for encoding... |
|
taiyofj says:
javascript decoder. |
|
Wonderm00n says:
Great topic kellan! |
|
Tim Parenti says:
Thanks for the information. I've created a simple, web-based implementation at www.timparenti.com/dev/flickr/shortlink/ |
|
burntoutcar says:
Any reason why this can't be incorporated into the "Share This" widget at the top right of each photo page?
|
|
kellan says:
Btw valid paths after the photo id will be passed along now. |
|
Kohichi says:
python decoder snippet
ages ago (permalink) |
|
Rex Roof says:
If these are really Base58, why doesn't the Math:Int2Base perl module work?
|
|
Rex Roof says:
Oooh, because you aren't using regular Base58. you're using Base62 with your own characters removed. Sorry, answered my own question.
|
|
(robcee) says:
my colleague Johnath converted this to a shorter Firefox bookmarklet using the page's contained <link rev="canonical"> tag: |
|
cmort says:
and a simple variation of @robceemoz's post to send it straight to twitter |
|
bitrot says:
I've just posted up a Greasemonkey script based on Xenocryst @ Antares Scorpii's bookmarklet (above): |
|
kellan says:
Rex, don't know if you're still looking for a Perl module, but check out |
|
andrhamm says:
Will there ever be the ability to use this URL shortening for sets?
|
|
opello says:
:
So that it doesn't introduce a javascript error when used on non-flickr pages (accidental clicks). I didn't see adding further error checking as worthwhile, but someone else might. ages ago (permalink) |
|
Zoolcar9 says:
I wrote a Firefox extension to get flic.kr shortened URL from context menu if you right click on Flickr photo, link, or Flickr photo page. Please try it |
|
frog23-net says:
Here is the Java Version: |
|
exuberant jeans [deleted] says:
Any chance of m.flic.kr redirecting to an m.flickr.com page?
|
|
flowolf says:
i wrote a bash version to convert a photo ID into the base58 photo id and vice versa: |
|
kellan says:
And I've added the much requested img urls. |
|
Jan Hapke says:
It would be cool if this also worked for sets. So we could use URLs like |
|
PetroleumJelliffe says:
Does the URL shortener only work for photos because you can still access photos with just their ID using this: |
|
Sybren A. Stüvel says:
Support for the short photo page URL has been included in version 1.4 of the Python FlickrAPI kit, released today. For more information see stuvel.eu/archive/119/python-flickr-api-14-released
|
|
jolinwarren says:
Here's an AppleScript version of the encoder in this post:
ages ago (permalink) |
|
tjieftjaf says:
I use this function in MySQL:
And then in your SELECT, INSERT, etc.:
Based on a post by Barry Gould on the MySQL forum. ages ago (permalink) |
|
whatsthatpicture says:
Hi, I'm not after Flickr's trade secrets, but is there any broad evidence as to how successful the implementation of short urls has been on Flickr, and how much they are used? I'm trying to get a feel for whether this is worth doing on a museums collection catalogue.
|
|
dopiaza says:
I think it depends on how you expect your catalogue to get used. I see the short URLs bandied around a lot on Twitter, where space is at a premium, but I don't really see them much in other contexts. |
|
scoopedup20 says:
where is the callback url field
|
|
andre.laszlo says:
It should be noted that if you try kellan's php algorithm above and get your id from the rest api interface for example, you get utf-8 encoded data and the algorithm will not work unless you convert it to something that php can handle. Using iconv() for example. This is what happens when you end up with 4gLq58 all the time :)
|
|
alavoy says:
I posted an update to the Base 58 Objective-C Encoder to now include Decoding: |
|
Milgrim says:
more python code:
ages ago (permalink) |
|
tjieftjaf says:
It looks like flic.kr/s/{short-set-id} is now working too!
|
|
daruyanagi says:
by C# (string class extention) |
|
tarmo888 says:
Would be nice if these 2 formats would be added to shorturl too. |
|
richard.mark.ward says:
Sorry for dredging up a very old discussion - but how are the set ids encoded? using the base58 encoder / decoder for the short url / id seems not to match.
|
|
dmitriyk says:
Not that there's clamor for this, but here's a Scala Base58 encoder and decoder: |
|
dmitriyk says:
In writing some unit tests for my application, I came across a curious and nonobvious property of Flickr's Base58 algorithm implementation that I feel should be documented somewhere. |
|
xGnarRx says:
GO (golang) encoder: |
|
ifree0 says:
Here is the emacs vesion of base-58-encode |
|
ifree0 says:
Can I get better resolution than this flic.kr/p/img/$shortid_[stm].jpg? Or there is a way to get image's url from it't id?
|
|
ke_1k says:
Hi, I'm interested in the history of the Base58 algorithm. |
|
ke_1k says:
Of course already googled, and failed. What could you find?
|
|
Sam Judson says:
Yeah, I googled it and only found Flickr and Bitcoin, as you said. |
|
ke_1k says:
I'm surprised and glad to get such a valuable information. |
|
iam.abu.mohammad says:
M
|
|
iam.abu.mohammad says:
Need url flickr
|
|