Given an image file name, how do you programmatically
retrieve the permalink?
E.g. given Kohila_vesiveski2.jpg I can easily infer
http://commons.wikimedia.org/wiki/File:Kohila_vesiveski2.jpg
but not
http://upload.wikimedia.org/wikipedia/commons/thumb/2/24/Kohila_vesiveski2.jpg/320px-Kohila_vesiveski2.jpg
Where does the "/2/24/" comes from? (The rest of the URL seems
to follow a regular pattern.)