On Thu, Sep 4, 2014 at 12:26 PM, Jonas Öberg <jonas@commonsmachinery.se> wrote:
But in order to do so, we need information from Commons, and we want to make this as easy on the WMF servers as possible, so we'd appreciate some help and pointers. What we're looking at retrieving is information about (1) title, (2) author, (3) license, and (4) thumbnails of medium size.

Not sure what you mean by title (the filename might be the closest thing - files have a description but that's long and can contain arbitrary HTML), but for author/license you can use the imageinfo/extmetadata API. [1][2] (The author name might also contain HTML, and in many cases complex structure like a listing of multiple authors.)

The ongoing structured data project [3] will hopefully make it easier to process image attribution metadata.

From what we can understand, you can request any size thumbnail on an image simply by prefixing it with the size you want (like 123x-Filename.jpg). But it seems really silly to always request 640x for instance, since that would mean the WMF servers would need to generate that for us specifically if the resolution doesn't exist.

What we'd find much more appealing is to be able to determine before making the call what sizes already exist and which can be retrieved without the WMF servers needing to rescale them for us. And while the viewer on Commons do seem to offer thumbnails in various sizes, we can't seem to get that information from any API.

There is no way to know whether a size exists already (other than trying). Standardizing some common sizes is an ongoing effort, so the result is not set in stone yet, but we will probably end up with the standard screen widths, such as 640 and 800 pixel; various tools use tools use those already.


[1] https://www.mediawiki.org/wiki/API:Properties#imageinfo_.2F_ii
[2] https://en.wikipedia.org/w/api.php?format=jsonfm&action=query&titles=File:30C3_Commons_Machinery_2.jpg&prop=imageinfo&iiprop=extmetadata&iiextmetadatafilter=ObjectName|Artist|LicenseShortName
[3] https://commons.wikimedia.org/wiki/Commons:Structured_data