libravatar-0.1.0.1: Use Libravatar, the decentralized avatar delivery service

Safe HaskellNone
LanguageHaskell2010

Network.Libravatar

Synopsis

Documentation

avatarUrl Source

Arguments

:: Either String String

Email or OpenID

-> Bool

Whether to use HTTPS

-> Maybe String

Default picture URL if avatar not found

-> Maybe Int

Image size in pixels, default is 80

-> IO (Maybe String) 

Return a URL to the avatar image.

Examples:

Email, HTTP, default fallback (libravatar's CDN), default size (80):

>>> avatarUrl (Left "john@doe.org") False Nothing Nothing
Just "http://cdn.libravatar.org/avatar/bc6a715808d9aae0ddeefb1e47e482a6"

Email, HTTPS, default fallback, size 100. But now use an email with a domain which has SRV records for avatars:

>>> avatarUrl (Left "fr33domlover@rel4tion.org") True Nothing (Just 100)
Just "https://avatars.rel4tion.org:5679/avatar/e9e9ccabc2a166b1783bd7f4f9ceb376?s=100"

OpenID, HTTPS, specified fallback (special value "retro"), default size (80):

>>> avatarUrl (Right "https://examplibre.org/accounts/xyz/id") True (Just "retro") Nothing
Just "https://seccdn.libravatar.org/avatar/c2cbc5f5a1784fa7105380e550360d73f15c4c1f9c7ca1ac436c45a33027fcd7?d=retro"

(Note that the 2nd example uses dummy SRV records created by the author, and he doesn't really run (at the time of writing) a Libravatar provider. This is just an example, the specific URL here will probably result with 404.)