1Gravatar::URL(3) User Contributed Perl Documentation Gravatar::URL(3)
2
3
4
6 Gravatar::URL - Make URLs for Gravatars from an email address
7
9 use Gravatar::URL;
10
11 my $gravatar_id = gravatar_id($email);
12
13 my $gravatar_url = gravatar_url(email => $email);
14
16 A Gravatar is a Globally Recognized Avatar for a given email address.
17 This allows you to have a global picture associated with your email
18 address. You can look up the Gravatar for any email address by
19 constructing a URL to get the image from gravatar.com. This module
20 does that.
21
22 Examples of use include the author faces on <http://search.cpan.org>.
23
24 See <http://gravatar.com> for more info.
25
27 gravatar_url
28
29 # By email
30 my $url = gravatar_url( email => $email, %options );
31
32 # By gravatar ID
33 my $url = gravatar_url( id => $id, %options );
34
35 Constructs a URL to fetch the gravatar for a given $email or $id.
36
37 $id is a gravatar ID. See "gravatar_id" for more information.
38
39 %options are optional and are...
40
41 rating
42
43 A user can rate how offensive the content of their gravatar is, like a
44 movie. The ratings are g, pg, r and x. If you specify a rating it is
45 the highest rating that will be given.
46
47 rating => "r" # includes g, pg and r
48
49 size
50
51 Specifies the desired width and height of the gravatar (gravatars are
52 square).
53
54 Valid values are from 1 to 512 inclusive. Any size other than 80 may
55 cause the original gravatar image to be downsampled using bicubic
56 resampling before output.
57
58 size => 40, # 40 x 40 image
59
60 default
61
62 The url to use if the user has no gravatar or has none that fits your
63 rating requirements.
64
65 default => "https://secure.wikimedia.org/wikipedia/en/wiki/File:Mad30.jpg"
66
67 Relative URLs will be relative to the base (ie. gravatar.com), not your
68 web site.
69
70 Gravatar defines special values that you may use as a default to
71 produce dynamic default images. These are "identicon", "monsterid",
72 "wavatar" and "retro". "404" will cause the URL to return an HTTP 404
73 "Not Found" error instead whereas "mm" will display the same "mystery
74 man" image for all missing people. See
75 <http://en.gravatar.com/site/implement/url> for more info.
76
77 If omitted, Gravatar will serve up their default image, the blue G.
78
79 border
80
81 DEPRECATED! This key has been removed from the Gravatar protocol. It
82 will be removed from future versions of Gravatar::URL.
83
84 Gravatars can be requested to have a 1 pixel colored border. If you'd
85 like that, pass in the color to border as a 3 or 6 digit hex string.
86
87 border => "000000", # a black border, like my soul
88 border => "000", # black, but in 3 digits
89
90 base
91
92 This is the URL of the location of the Gravatar server you wish to grab
93 Gravatars from. Defaults to <http://www.gravatar.com/avatar/"> for
94 HTTP and <https://secure.gravatar.com/avatar/> for HTTPS.
95
96 short_keys
97
98 If true, use short key names when constructing the URL. "s" instead of
99 "size", "r" instead of "ratings" and so on.
100
101 short_keys defaults to true.
102
103 https
104
105 If true, serve avatars over HTTPS instead of HTTP.
106
107 You should select this option if your site is served over HTTPS to
108 avoid browser warnings about the presence of insecure content.
109
110 https defaults to false.
111
112 gravatar_id
113
114 my $id = gravatar_id($email);
115
116 Converts an $email address into its Gravatar $id.
117
119 Thanks to gravatar.com for coming up with the whole idea and Ashley
120 Pond V from whose Template::Plugin::Gravatar I took most of the
121 original code.
122
124 Copyright 2007 - 2009, Michael G Schwern <schwern@pobox.com>.
125 Copyright 2011, Francois Marier <fmarier@gmail.com>.
126
127 This program is free software; you can redistribute it and/or modify it
128 under the same terms as Perl itself.
129
130 See http://dev.perl.org/licenses/artistic.html
131
133 Template::Plugin::Gravatar - a Gravatar plugin for Template Toolkit
134
135 <http://www.gravatar.com> - The Gravatar web site
136
137 <http://en.gravatar.com/site/implement/url> - The Gravatar URL
138 implementor's guide
139
140
141
142perl v5.32.0 2020-07-28 Gravatar::URL(3)