Am 04.09.2014 12:26, schrieb Jonas Öberg:
The first three we can get from pretty much either
API, or extract directly from
a dump file. The latter is eluding us though, for two reasons. One is that a
file, like 30C3_Commons_Machinery_2.jpg, is actually in the /b/ba/ directory -
but where this /b/ba/ comes from (a hash?) is unclear to us now, and it's not
something we find in the dumps - though we can get it from one of the APIs.
Yes, /b/ba ist based on the first two digits of the MD5 hash of the title:
md5( "30C3_Commons_Machinery_2.jpg" ) -> ba253c78d894a80788940a3ca765debb
But this is "arcane knowledge" which nobody should really rely on. The
canonical
way would be to use
https://commons.wikimedia.org/wiki/Special:Redirect/file/30C3_Commons_Machi…
Which generates a redirect to
https://upload.wikimedia.org/wikipedia/commons/b/ba/30C3_Commons_Machinery_…
To get a thumbnail, you can directly manipulate that URL, by inserting "thumb/"
and the desired size in the correct location (maybe Special:Redirect can do that
for you, but I do not know how):
https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/30C3_Commons_Mach…
HTH
Daniel