Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
:: Either String String | User address. Email or OpenID. |
-> Bool | Whether the generated URL should be secure (use HTTPS). |
-> Maybe String | Default image URL if the user address isn't found in the Libravatar
server's database. If you pass |
-> Maybe Int | Image size in pixels, default is 80. |
-> IO (Maybe String) |
Return a URL to the avatar image.
If an error occurs, return Nothing
. Currently, this happens only if the
user address (first parameter) fails to be parsed.
Examples:
Email, HTTP, default fallback image (the libravatar logo), default size (80):
>>>
avatarUrl (Left "john@doe.org") False Nothing Nothing
Just "http://cdn.libravatar.org/avatar/bc6a715808d9aae0ddeefb1e47e482a6"
Email, HTTPS, default fallback image, 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.)