On Tue, Jan 08, 2013 at 05:17:18PM -0500, Tom MacWright wrote: > Hey all (and especially Grant & Jochen), > > So, the iD editor has this nice 'reference pane' which shows tag/value > summaries from TagInfo, if available. TagInfo also provides thumbnails for > these combos in the form File:Foo. Unfortunately that doesn't map to a real > URL (by design). There's an API to get at the contents, like > > > http://wiki.openstreetmap.org/w/api.php?action=query&prop=imageinfo&titles=Image:Residential.jpg&iiprop=url|content&format=xml > > But this doesn't support CORS. It doesn't look like MediaWiki supports CORS > at this point ( https://gerrit.wikimedia.org/r/#/c/9718/ ), so either we're > looking at implementing this on a server-level in Apache, having TagInfo > expose actual image URLs, or implementing it in MediaWiki.
I vaguely remember that I had the same problem (ie not having the final image URL) when implementing taginfo and then put it on the TODO list and never got around to it. I think this should be added to taginfo. This way this only has to be implemented once and taginfo itself and everybody else could easily use it. Taginfo currently has about 900 different images for keys/tags. The mediawiki API call described above can take several titles, so I could probably ask for 10 titles per call or so and need 90 API calls to get all that info. On the other hand some quick checks reveals that the URL of the image seems to be calculated with a simple MD5 sum of the image name. It might not be the "correct way" to calculate this ourselves, but certainly easier to do than asking the API. There is one more hitch there: Image size. You probably want the images all to be the same size. Mediawiki can calculate (and cache) thumbnails for you. The URL also seems to be easily deduced. It looks like this: http://wiki.openstreetmap.org/w/images/thumb/1/18/Barrier_drehkreuz.JPG/100px-Barrier_drehkreuz.JPG for image http://wiki.openstreetmap.org/w/images/1/18/Barrier_drehkreuz.JPG So I propose the following: I'll implement the MD5 thing myself in the taginfo API and you can then just use that URL. If, for some reason, this doesn't work in the future, I can always change taginfo to use the API to get the URLs. I'll have to think about how exactly the interface is going to look like so it is easy to assemble thumbnail URLs. Jochen -- Jochen Topf [email protected] http://www.remote.org/jochen/ +49-721-388298 _______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

