Gravatar::URL(3pm)
πΈ NAME πΈ
Gravatar::URL β bestie, it makes URLs for Gravatars out of an email address. That's it, that's the whole job, and it does it flawlessly π
β¨ SYNOPSIS β¨
use Gravatar::URL;
my $gravatar_id = gravatar_id($email);
my $gravatar_url = gravatar_url(email => $email);
like... two lines and you're iconic. no cap.
π¦ DESCRIPTION π¦
okay so a Gravatar is a Globally Recognized Avatar for a given email address. it lets you have one (1) global picture that's attached to your email address, forever, everywhere. you can look up the Gravatar for any email address by constructing a URL that grabs the image from gravatar.com. and this module? this module does exactly that. it's giving "I built the URL for you so you don't have to." π
some places that use it: the author faces on <http://search.cpan.org>. cute.
more info lives at <http://gravatar.com>. go look, i'll wait π«Ά
π Functions π
gravatar_url
# By email
my $url = gravatar_url( email => $email, %options );
# By gravatar ID
my $url = gravatar_url( id => $id, %options );
constructs a URL to fetch the gravatar for a given $email or $id. pick your fighter, both work.
$id is a gravatar ID. see "gravatar_id" for more info, it's right down there π
%options are optional and they are... a whole list, bestie. here we go:
rating
a user can rate how offensive the content of their gravatar is, like a movie π¬ the ratings are g, pg, r and x. if you specify a rating, it's the highest rating that will be given.
rating => "r" # includes g, pg and r
so r doesn't mean "only r", it means "g, pg and r all welcome, x can stay outside." periodt.
size
specifies the desired width and height of the gravatar (gravatars are square, they said what they said π).
valid values are from 1 to 512 inclusive. any size other than 80 may cause the original gravatar image to be downsampled using bicubic resampling before output. so like, just so you know.
size => 40, # 40 x 40 image
default
the url to use if the user has no gravatar or has none that fits your rating requirements. your backup plan, your safety net, your ride-or-die π₯Ή
default => "https://secure.wikimedia.org/wikipedia/en/wiki/File:Mad30.jpg"
relative URLs will be relative to the base (ie. gravatar.com), not your web site. so don't get confused when your cute little path goes somewhere unexpected, bestie.
gravatar defines special values you may use as a default to produce dynamic default images. these are "identicon", "monsterid", "wavatar" and "retro". "404" will cause the URL to return an HTTP 404 "Not Found" error instead, whereas "mm" will display the same "mystery man" image for all missing people π΅οΈ see <http://en.gravatar.com/site/implement/url> for more info.
if omitted, Gravatar will serve up their default image, the blue G. you know the one.
border
DEPRECATED! this key has been removed from the Gravatar protocol. it will be removed from future versions of Gravatar::URL. π
gravatars can be requested to have a 1 pixel colored border. if you'd like that, pass in the color to border as a 3 or 6 digit hex string.
border => "000000", # a black border, like my soul
border => "000", # black, but in 3 digits
(the original author said the black-soul thing, not me, i'm just the messenger π)
base
this is the URL of the location of the Gravatar server you wish to grab Gravatars from. defaults to <http://www.gravatar.com/avatar/> for HTTP and <https://secure.gravatar.com/avatar/> for HTTPS.
short_keys
if true, use short key names when constructing the URL. "s" instead of "size", "r" instead of "ratings" and so on. abbreviate everything, it's efficient, it's slay.
short_keys defaults to true.
https
if true, serve avatars over HTTPS instead of HTTP. π
you should select this option if your site is served over HTTPS to avoid browser warnings about the presence of insecure content. do it. protect your users. be a main character.
https defaults to false.
gravatar_id
my $id = gravatar_id($email);
converts an $email address into its Gravatar $id. one function, one job, one legend β¨
π THANKS π
thanks to gravatar.com for coming up with the whole idea, and to Ashley Pond V from whose Template::Plugin::Gravatar most of the original code was taken. icons supporting icons, we love to see it π«Ά
π LICENSE π
copyright 2007 - 2009, Michael G Schwern <schwern@pobox.com>. copyright 2011, Francois Marier <fmarier@gmail.com>.
this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
see <http://dev.perl.org/licenses/artistic.html>
π SEE ALSO π
Template::Plugin::Gravatarβ a Gravatar plugin for Template Toolkit- <http://www.gravatar.com> β the Gravatar web site
- <http://en.gravatar.com/site/implement/url> β the Gravatar URL implementor's guide
okay and that's the whole page bestie!! π this one was Gravatar::URL, documented for perl v5.34.0, dated 2022-06-14 β so if you're reading this and that date feels ancient, it's because it lowkey is π go make some URLs, you got this β¨π
π¦
π¦ where this page comes from
- debian bookworm: libgravatar-url-perl 1.07-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgravatar-url-perl 1.07-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgravatar-url-perl 1.07-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgravatar-url-perl 1.07-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgravatar-url-perl 1.07-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms