Also there are Special:FilePath and thumb.php. I'm not sure how this affects caching though.

http://commons.wikimedia.org/wiki/Special:FilePath/Example.svg

http://commons.wikimedia.org/w/thumb.php?f=Example.svg&w=420

-Liangent

On Jul 3, 2014 4:50 AM, "Emilio J. Rodríguez-Posada" <emijrp@gmail.com> wrote:
Hello Markus;

The URL of a Commons image is build like this:

https://upload.wikimedia.org/wikipedia/commons/x/xy/File_name.ext

Where X and XY are the first char and first&second chars respectively of the md5sum of the filename (replacing the spaces with _).

For a 200px thumb:

https://upload.wikimedia.org/wikipedia/commons/thumb/x/xy/File_name.ext/200px-File_name.ext

The SVG files are a special case, therefore .png is appended to .ext, being .ext.png. For SVG doesn't mind to use big thumb sizes, but when file is JPG, don't try to generate a thumb bigger than the original file or you will get a beautiful error.

Regards


2014-07-02 22:33 GMT+02:00 Markus Krötzsch <markus@semantic-mediawiki.org>:

Dear Wikidatarians,

>From Commons media properties, I get the string name of a file on Commons. I can easily use it to build a link to the Commons page fo rthat image.

* But how do I get the raw image URL?
* And can I also get the raw URL of a small-scale (thumbnail) image?

I would like to beautify my Wikidata applications to show some images. I know this is more of a general MediaWiki question, but it is much more relevant in Wikidata, so I am posting it here first. I guess somebody has already solved this since we have images in various Wikidata-based applications and gadgets.

Thanks

Markus

_______________________________________________
Wikidata-l mailing list
Wikidata-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-l


_______________________________________________
Wikidata-l mailing list
Wikidata-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-l