Function Repository Resource:

ImportGravatarImage

Source Notebook

Import an avatar image from the Gravatar service

Contributed by: Cody Woodard (Wolfram Research)

ResourceFunction["ImportGravatarImage"][email]

imports an avatar image associated with the email address email from the Gravatar service.

Details and Options

The following options are supported:
ImageSize80size of returned avatar
"DefaultImage"""URL or ID of default image
"ForceDefault"Falsealways return "DefaultImage"
"Rating""G"return avatars suitable to rating
"DefaultImage" is a fallback avatar used when no avatar is available (or applicable) for an email address. It may be any public URL (such as a String, URL or CloudObject), or one of the following options:
"mp"a generic "missing person" avatar
"identicon"a generated colorful geometric pattern
"monsterid"a generated "monster" avatar
"wavatar"a generated "cartoon" avatar
"retro"a generated "8-bit face" avatar
"robohash"a generated "robot" avatar
"404"returns HTTP 404 instead of a default image
"blank"a transparent PNG image
If "ForceDefault" is True, the Gravatar service will always return the "DefaultImage" fallback avatar.
"Rating" may have one of the following options:
"G"suitable for display on all websites with any audience type
"PG"may contain rude gestures, provocatively dressed individuals, lesser swear words or mild violence
"R"may contain such things as harsh profanity, intense violence, nudity or hard drug use
"X"may contain hardcore sexual imagery or extremely disturbing violence

Examples

Basic Examples (1) 

Import an avatar from an email address:

In[1]:=
ResourceFunction["ImportGravatarImage"]["spam@codyw.com"]
Out[1]=

Options (5) 

ImageSize (1) 

Specify a nondefault image size:

In[2]:=
ResourceFunction["ImportGravatarImage"]["spam@codyw.com", ImageSize -> 128]
Out[2]=

DefaultImage (1) 

Specify a fallback avatar:

In[3]:=
ResourceFunction["ImportGravatarImage"]["test@example.com", "DefaultImage" -> "identicon"]
Out[3]=

ForceDefault (2) 

Always show the fallback avatar:

In[4]:=
ResourceFunction["ImportGravatarImage"]["spam@codyw.com", "ForceDefault" -> True]
Out[4]=

If you set "DefaultImage" to one of the generators and set "ForceDefault" to True, this turns the Gravatar service into an avatar generator:

In[5]:=
ResourceFunction["ImportGravatarImage"]["spam@codyw.com", "ForceDefault" -> True, "DefaultImage" -> "identicon"]
Out[5]=

Rating (1) 

By default, the Gravatar service will only allow avatars that have a "G" rating. You can allow "PG"-, "R"- or "X"-rated avatars if you wish:

In[6]:=
ResourceFunction["ImportGravatarImage"]["spam@codyw.com", "Rating" -> "PG"]
Out[6]=

Version History

  • 1.0.0 – 25 July 2019

License Information