RESTful images

Thought I’d play around and make a WordPress plugin to show a selected Geograph image, and form the beginnings of a REST style API for Geograph.

First thing was to provide a way to obtain picture metadata – this was pretty straightforward – requesting a URL like this

Returns an XML result like this

<geograph>
<status state=”ok”/>
<title>From Bygrave to Baldock</title>
<gridref>TL2435</gridref>
<user profile=”http://www.geograph.org.uk/profile.php?u=2″>Paul Dixon</user>
<img src=”http://www.geograph.org.uk/photos/04/02/040212_f4e3079a.jpg” width=”480″ height=”640″/>
</geograph>

I knocked up a plugin which maintained a list of “interesting” picture ids, and if it has been displaying one for more than 24hrs, requests the metadata for the next image in the queue, pulls in the image and resizes it suit this layout, and generates a cached HTML fragment for display

I could do with adding some extra metadata to the result, as well making new REST style APIs for user profiles, grid squares etc. We already have an API for bulk data retrieval which needs a key, but these simpler APIs might enable more little gizmos like this one to be produced.

One thought on “RESTful images

Comments are closed.