[gravatar]

Description

Link: [gravatar]
Author: Jason Huck
Category: Utility
Version: 8.5.x
License: Public Domain
Posted: Sep. 07, 2010
Updated: Jan. 01, 0001
More by this author...

Retrieves the Gravatar for the given email address. Optionally accepts a rating, a size, and a link to a custom default icon.

Parameters

none


Sample Usage

gravatar('joe@schmoe.com', -size=80, -rating='G');
						

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
define_tag(
	'gravatar',
	-req='email',
	-opt='rating',
	-opt='default',
	-opt='size', -type='integer',
	-priority='replace',
	-encodenone,
	-description='Retrieves the Gravatar for the given email address.'
);
	fail_if(
		!valid_email(#email),
		-1, 'Email address supplied is not valid.'
	);

	fail_if(
		local_defined('rating') && (:'G','PG','R','X') !>> #rating,
		-1, 'Rating must be one of G, PG, R, or X.'
	);
	
	fail_if(
		local_defined('size') && (#size < 1 || #size > 80),
		-1, 'Size must be between 1 and 80.'
	);
	
	fail_if(
		local_defined('default') && !valid_url(#default),
		-1, 'Default must be a complete, valid URL.'
	);

	local('hash') = encrypt_md5(#email);
	local('url') = 'http://www.gravatar.com/avatar.php?gravatar_id=' + #hash;
	local_defined('rating') ? #url += '&rating=' + #rating;
	local_defined('size') ? #url += '&size=' + #size;
	local_defined('default') ? #url += '&default=' + encode_stricturl(#default);
	return(#url);		
/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net