NeoFaker.Gravatar (neo_faker v0.11.0)
View SourceFunctions for generating random Gravatar URLs.
This module is based on the Gravatar API documentation.
Summary
Functions
Generates a Gravatar image URL for the given email address with customizable size and fallback options.
Types
@type email() :: String.t() | nil
Email address.
Functions
Generates a Gravatar image URL for the given email address with customizable size and fallback options.
If no email is provided, a random email is used. The resulting URL includes query parameters for image size and fallback image type.
Options
The accepted options are:
:size
- Defines the image size.:fallback
- Specifies the default fallback image.
The values for :size
can be:
nil
- Uses80px
(default).1
-2048
- The image size in pixels (valid range:1
to2048
).
The values for :fallback
can be:
:identicon
- Generates an "identicon" image (default).:monsterid
- Generates a "monsterid" image.:wavatar
- Generates a "wavatar" image.:robohash
- Generates a "robohash" image.
Examples
iex> NeoFaker.Gravatar.display()
"https://gravatar.com/avatar/<hashed_email>?d=identicon&s=80"
iex> NeoFaker.Gravatar.display("john.doe@example.com")
"https://gravatar.com/avatar/<hashed_email>?d=identicon&s=80"
iex> NeoFaker.Gravatar.display("john.doe@example.com", size: 100)
"https://gravatar.com/avatar/<hashed_email>?d=identicon&s=100"
iex> NeoFaker.Gravatar.display("john.doe@example.com", fallback: :monsterid)
"https://gravatar.com/avatar/<hashed_email>?d=monsterid&s=80"