-=( In Between )=-

Scholarly Online Publishing, Open Access and Library Related Technology
My Internet Resources - My Department - My Profile
Search the RDN Internet Resource Catalogues -
  
 

Using cover images from Amazon

 
By ellermann at Sat, 2006-04-15 12:07 | amazon | linking


It doesn't seem to be an official service from Amazon, but it is common knowledge that images can be retrieved from Amazon by sending a URL of a certain form. Such images can be used by libraries too when making lists of books (Latest acquisitions, exhibitions, perhaps even in the catalog).

I wanted to know what the "protocol" is because I am working on an XSLT stylesheet for a list of Latest Acquisitions of our library and thought that those cover images might make it look better. Before starting a series of experiments to see what Amazon really had to offer, I first did a search on the Internet and, luckily, came across a nice page by Nat Gertler called Abusing Amazon images who has already done a number of experiments to determine the way these URLs can be used.

They are exremely ugly, but they do seem to have a clear pattern. The pattern is as follows:

[BaseURL][ASIN].[country-code].[commands]

The most important bit of information in this URL is the ASIN number, the number that Amazon uses to identify the items in its stock. In the case of books, the ASIN is simply the ISBN (without spaces and bars).

The BaseURL can be

http://images.amazon.com/images/P/

and ASIN, country-code and commands are separated by a dot. Other BaseURL's are possible too, for instance

http://images-eu.amazon.com/images/P/.

An example of a real and usable URL is:

<a href="http://images.amazon.com/images/P/1582406006.01.THUMBZZZ.jpg">http://images.amazon.com/images/P/1582406006.01.THUMBZZZ.jpg</a>

The country code can be a two-letter-code, where 01 is for probing the amazon in the US and Canada (amazon.com), 02 for the UK (amazon.co.uk), 03 for Germany (amazon.de). A full list of country codes I wasn't able to find.

The commands section is the ugliest part, and it is hard to imagine anyone, sane of mind, to have set this up. But what it amounts to is that certain ugly strings have certain nice results. The command string can be in one of three formats, two of which I'll discuss here shortly. For more information, you know where to go to. :)

  1. A size specification
  2. A series of commands to transform a picture

Examples of the strings in format 1, are:
THUMBZZZ Returns a small size picture

TZZZZZZZ Default size picture

MZZZZZZZ Medium size

LZZZZZZZ Large size

In the other format it is also possible to specify sizes, but extra commands can be attached to these strings (by prefixing them to the size specification and embedding them into two underscores) to achieve some effects, like adding a border and shadows to the pictures. For example, getting a medium sized image we have to use SCMZZZZZZZ and to add a shadow to it, we have to use PB, which leads to

_PB_SCMZZZZZZZ

The final URL would then be

<a href="http://images.amazon.com/images/P/1582406006.01._PB_SCMZZZZZZZ_.jpg">http://images.amazon.com/images/P/1582406006.01._PB_SCMZZZZZZZ_.jpg</a>

And the result is:


Of course Amazon has more to offer here than just links. It is possible too to direct the user to the site where the book can be ordered, as you can see below.


But the full use of Amazon's capabilities is too much for one post. Perhaps another time.

  
-=( Premature Optimization Is The Root Of All Evil )=-