[ Team LiB ] |
Hack 5 Link Directly to Product ImagesJust as product detail URLs follow a certain pattern, image URLs are just as predictable. Just as every page has a URL, so too does every product image. Finding the URL is fairly easy in most browsers. In Internet Explorer on Windows, right-click the image and choose Properties. Once you have the image URL, you can bring it up in the browser by placing it in the address bar. Some browsers—Safari for Mac OS X, for instance—make this a single step via the Open Image in New Window context-menu item. Amazon image URLs are just as dynamic as Amazon pages. By understanding the image URL pattern, you can find images for products based on their ASIN and customize from there. For instance, the following standard image URL brings up a standard product image, the Google Hacks book cover in Figure 1-6: http://images.amazon.com/images/P/0596004478.01._PE30_PI_SCMZZZZZZZ_.jpg Figure 1-6. Google Hacks product imageIf you're getting good at spotting ASINs [Hack #1], you'll see this product's ASIN in the URL. By changing it, you can find the image for other products (see Figure 1-7): http://images.amazon.com/images/P/0596004613.01._PE30_PI_SCMZZZZZZZ_.jpg Figure 1-7. Linux Server Hacks product imageKeep in mind that you can link to an image of any product that Amazon sells, as long as you have the ASIN. The following URL shows an iPod MP3 player from Amazon's Electronics catalog (see Figure 1-8): http://images.amazon.com/images/P/B00006FDRB.01._PE30_PI_SCMZZZZZZZ_.jpg
Figure 1-8. iPod product imageThese images have something else in common: a 30% off graphic in the lower-right corner. With closer examination of the URLs, you can see what might be affecting the graphic. The section PE30 corresponds with the discount amount. What happens if we change this value? http://images.amazon.com/images/P/0596004605.01._PE50_PI_SCMZZZZZZZ_.jpg
The PE50 changes the discount to 50%, as seen in Figure 1-9. Figure 1-9. Mac OS X Hacks product image, with 50% Discount
What if you didn't want a discount at all? Take out the discount designation for a discount-free image like that shown in Figure 1-10: http://images.amazon.com/images/P/0596004605.01._SCMZZZZZZZ_.jpg Figure 1-10. Mac OS X Hacks image with no discountDifferent sizes of images are also predictable and can be requested with a URL. The portion of the URL with all those ZZZ's specifies its size. The codes and their associated sizes are listed in Table 1-1.
The actual pixel size will vary by item, but these are good approximations for books. By looking at the URLs for different products, you may even pick up other variable style codes. Throwing a TT in the mix (as Duke Bhuphaibool at Amazon suggested) tilts the product image, shown in Figure 1-11: http://images.amazon.com/images/P/0596004478.01.20TTZZZZ.jpg Figure 1-11. Google Hacks image, tiltedAnd TR sets it straight again: http://images.amazon.com/images/P/0596004478.01.20TRZZZZ.jpg Most product images on Amazon are JPEG files, but there is a way to force the GIF format: http://images.amazon.com/images/P/0596004478.01._FMgif_ZZZZZZZZZZ_.gif Unfortunately, you're stuck with the medium size. There isn't a way to request a larger GIF. |
[ Team LiB ] |