-
Notifications
You must be signed in to change notification settings - Fork 0
/
pi.gravatamatic.php
executable file
·48 lines (39 loc) · 1.8 KB
/
pi.gravatamatic.php
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
43
44
45
46
47
48
<?php
class Plugin_gravatamatic extends Plugin {
var $meta = array(
'name' => 'Gravatamatic',
'version' => '0.1',
'author' => 'Steven Milne',
'author_url' => 'http://stevenmilne.co.uk'
);
public function avatar()
{
$email = $this->fetchParam('email', null);
$baseurl = "http://www.gravatar.com/avatar/";
$size = $this->fetchParam('size', '80'); // default to 80px - size in pizels up to 2048
$rating = $this->fetchParam('rating', 'g'); // default to all audiences - g / pg / r / x
$default = $this->fetchParam('default', 'mm'); // default to all silhouette - mm / indenticon / monsterid / wavatar / retro or own url
$hash = md5( strtolower( trim( $email ) ) );
$options = "?s=".$size."&r=".$rating."&d=".urlencode($default);
$url = $baseurl.$hash.$options;
$return_array = array(
'email' => $email,
'width' => $size,
'height' => $size,
'avatar_url' => $url
);
return $return_array;
}
public function quicky()
{
$email = $this->fetchParam('email', null);
$baseurl = "http://www.gravatar.com/avatar/";
$size = $this->fetchParam('size', '80'); // default to 80px - size in pizels up to 2048
$rating = $this->fetchParam('rating', 'g'); // default to all audiences - g / pg / r / x
$default = $this->fetchParam('default', 'mm'); // default to all silhouette - mm / indenticon / monsterid / wavatar / retro or own url
$hash = md5( strtolower( trim( $email ) ) );
$options = "?s=".$size."&r=".$rating."&d=".urlencode($default);
$url = $baseurl.$hash.$options;
return "<img src=\"$url\" />";
}
}