Manipulating Image URLs

In previous sections, you saw how you could manipulate the suffix of the image URL to display the same image in different sizes (if they exist on the Image server). There are some additional manipulations you can perform using the URL and achieve image effects that are not offered by Amazon Associates Web Service operations.

Discounts are often a sales driver for products. Amazon Associates Web Service can display discount icons by appropriately manipulating the image URL. For example, to add a 20% off icon, add "_PE20" (PE stands for "percent") to the URL right after the image identifier, as follows:

http://images.amazon.com/images/P/0976925524.01._PE20_SCMZZZZZZZ_.jpg

The following figures shows the addition of the discount icon.

Change the percent off by changing the numerical value. For example, to make the discount icon 30%, use _PE30.

Previous sections discussed how items can be associated with many figures, each offering a different view of the item. Sometimes, you can manipulate the image URL to produce those images. For example, if you add to the URL PTnn, where nn is a two-digit integer, you can display alternate views of the image. For example, if you add _PT20 to the above URL, you get:

http://images.amazon.com/images/P/0976925524.01._PE20_PT20_SCMZZZZZZZ_.jpg

The corresponding image is:

Rotating the image is the default behavior for items that do not have alternate views.In other examples where there are alternate views, you get an entirely different view of an item. For example, the URL,

http://images.amazon.com/images/P/B000AYGDIO.01._SCMZZZZZZZ_.jpg

returns the following image.

By adding PT02 to the URL,

http://images.amazon.com/images/P/B000AYGDIO.01.PT02._SCMZZZZZZZ_.jpg

the image changes to the following.

By adding PT03 to the URL,

http://images.amazon.com/images/P/B000AYGDIO.01.PT03._SCMZZZZZZZ_.jpg

the image changes to the following:

Using these extensions increases performance because you are not making Amazon Associates Web Service requests to retrieve the images. On the other hand, not all images have alternate views, and those that do do not have the same number of alternate views. When you enter a PTnn value that does not reference an image, the Image server returns a .gif image that is 1 by 1 pixel large. So, to display all of the different views of an item, you can increment, in the image URL, the PTnn value until a 1 by 1 pixel image is returned.