It’s actually pretty easy once you find out how to do it. By having the artist and album name you can fetch the album artwork from Amazon in three different sizes.
With php5 it’s very easy since it has an integrated xml parser. All we have to do is this:
$url = simplexml_load_file('http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=12DR2PGAQT303YTEWP02&Operation=ItemSearch&SearchIndex=Music&Artist=ARTIST&ResponseGroup=Images&Keywords=ALBUMNAME');
Please note that in the url I’ve put ARTIST and ALBUMNAME, which you should replace with what you’re searching for. Doing so, we get an xml file from which we can display the image like this:
echo '<img src="' . $url->Items->Item->LargeImage->URL . '" />';
If we want the large one, that is. If we would like the medium one we would use MediumImage and SmallImage for the small one.
That’s it, it’s very useful if you are organizing your mp3 files or maybe building an online community or something.
Hope it helps somebody! If you find it useful, digg it!
ps: I forgot to mention that if you are using php4 this wont work, you will have to use another xml parser to fetch the image location from the xml provided by Amazon.