Once you have the file name, you can construct the file URL (description page, high-res image, and thumbnails) via this API:

https://commons.wikimedia.org/w/api.php?action=help&modules=query%2Bimageinfo

Example:
https://commons.wikimedia.org/w/api.php?action=query&titles=File:Albert%20Einstein%20Head.jpg&prop=imageinfo&iiprop=url&iiurlwidth=128


On Fri, Aug 14, 2015 at 10:32 AM Sachini Herath <sachini.mc@gmail.com> wrote:
Hi everyone,

I’m Sachini Herath, an undergraduate from Sri Lanka. I am working on building Linked Data mapping tools for Drupal 8 as my Google Summer of Code 2015 project. The tools would enable the users to map Drupal entities to Linked Data items. Details of the project can be found in my blog. http://alongthetrail-sachini.rhcloud.com/

To select a Linked Data item, a dropdown element similar to freebase-suggest widget is being developed, but in a more generic approach so that it can be configured with any Linked Data Provider.

For Wikidata, I'm using "wbsearchentities" API for querying and "wbgetentities" for retrieving information about individual items in json format. However I could not find a way to reconstruct the url of image property for an item, so that I can fetch the image (property P18, P154 etc) for displaying. Are there any APIs or alternative methods to fetch images from Wikidata?

I would also like to hear about any optimizations that can be done for the query or alternate APIs. For example an API to return id, label, description and image urls in just one/ few call/s.

Thank you
Sachini
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata