Image Proxy plug-in serves three different purposes:
The plug-in is invoked from the UI by the command 'imageproxy'. It can be called with a complete URL or with a record ID.
In the first case, it will simply request the image by the provided URL.
In the second case, the client must supply a sub-element name to look for images by. There are two options: 'usefield=md-isbn' or 'usefield=md-thumburl'.
In case of 'md-isbn' the plug-in will look for a cover image on Open Library using a random IBSN number from the record identified by the recid.
The plug-in will also need a size argument, which can be 'S', 'M' or 'L'.
In case of 'md-thumburl' the plug-in will use the address from a random 'md-thumburl' element in the record identified by the recid.
In any of these cases, the plug-in will make the request, follow up to one i redirect, cache the image on the session, and return the image to the client.
The plug-in will in other words return binary data.
Examples:
Look-up by URL: /service-proxy/?command=imageproxy&imageuri=http://covers.openlibrary.org/b/isbn/0345427653-M.jpg Look-up by ISBN - small cover page image: /service-proxy/?command=imageproxy&recid=title-complete%20star%20wars...of%20the%20jedi&usefield=md-isbn&size=S Look-up by thumbnail URL: /service-proxy/?command=imageproxy&recid=title-complete%20star%20wars...of%20the%20jedi&usefield=md-thumburl
This plug-in is configured in service-proxy.properties or equivalent.
Plugin class is registered with the following (name is arbitrary):
plugins.imageproxy = com.indexdata.serviceproxy.plugins.ImageProxyPlugin
ImageProxy is a stand-alone plug-in. It will return a binary response.
For example:
chains.imageproxy = imageproxy
# The URI at which to find cover images by ISBN and size imageproxy.OPEN_LIBRARY_IMAGE_URL = http://covers.openlibrary.org/b/isbn/${isbn}-${size}.jpg
imageproxy.CACHE_ON_SERVER = true # Whether the image should be cached on the server # (on the users HTTP session) # Default: true imageproxy.CACHE_IN_BROWSER = true # Whether the server should attempt to have the # browser cache the image. Actual caching is # browser dependent. # Default: true imageproxy.CACHE_MISSING_IMAGE = true # Whether the server should also cache missing # images (the noimage.gif). This would make no-images # faster but also implies that the plug-in gives up # finding the image at the first try. # Default: false imageproxy.CONNECTION_TIMEOUT = 5000 # Milliseconds to wait for a connection to the # image server in question before aborting # Default: 5000 imageproxy.SO_TIMEOUT = 5000 # Milliseconds to wait for a read operation # to get the image from the server before aborting # Default: 5000