[amazon_albumcover]

Description

Link: [amazon_albumcover]
Author: Jason Huck
Category: Utility
Version: 8.x
License:
Posted: Apr. 26, 2006
Updated: Apr. 26, 2006
More by this author...
This tag returns the first Large Image URL for the given album from Amazon Web Services. Requires a valid AWS Access Key ID.

Parameters

-key string, required A valid AWS Access Key ID.
-artist string, required The name of the artist.
-album string, required The name of the album.

Sample Usage

var('coverURL') = amazon_albumcover(
	-key=$key,
	-artist=$artist,
	-album=$album
);

$coverURL->size ? '<img src="' + $coverURL + '">';
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
define_tag(
	'albumcover',
	-namespace='amazon_',
	-required='key',
	-type='string',
	-required='artist',
	-type='string',
	-required='album',
	-type='string',
	-priority='replace',
	-description='Returns the first Large Image URL for the given album from Amazon Web Services.'
);
	local('baseurl' = 'http://webservices.amazon.com/onca/xml');

	local('params') = array(
		'Service' = 'AWSECommerceService',
		'AWSAccessKeyId' = #key,
		'Operation' = 'ItemSearch',
		'SearchIndex' = 'Music',
		'Artist' = encode_url(#artist),
		'Title' = encode_url(#album),
		'ResponseGroup' = 'Images'
	);
	
	local('response') = include_url(
		#baseurl,
		-getparams=#params
	);

	#response = string_replaceregexp(
		#response,
		-find='xmlns=".+?"',
		-replace=''
	);
	
	#response = xml(#response);
	
	local('imagedata') = #response->extract('//LargeImage/URL/text()');
	
	#imagedata->size ? return(#imagedata->first) | return;
/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular