Libravatar library for Nim, Gravatar alternative. Libravatar is an open source federated avatar api and service.
- Your users nor you dont need a Libravatar account if you dont want to, because if Libravatar cant find you it redirects you to your Gravatar, if you have no Gravatar then it returns a default autogenerated image.
- Federation supported passing
baseUrl
, DNS server discovery is up to you if you want to, Pull Request welcome. - 404 wont return 404, but a default image, use
default="404"
for a HTTP 404 Error. - Uses
func
so is Side Effects Free, works with Async & MultiSync. runnableExamples
included, Self-Documented, NEP-1 Ok.- Best quality avatar sizes are between
80
&128
,512
may or may not look a little stretched, depends on original quality. - Tiny and simple but reusable code.
- By design is also a Gravatar library :)
nimble install libravatar
- You can create an account for free, it only needs an email.
import libravatar
var email = "[email protected]"
getLibravatarUrl(email)
echo email
email = "[email protected]"
getLibravatarUrl(email, size=512, default="monsterid")
echo email
email = "[email protected]"
getLibravatarUrl(email, size=9, default="404", baseUrl="https://MyCustomFederatedServer.org/avatar/")
echo email
- This module is also a crossplatform command line terminal App.
- Just compile and run it, compiles to a single file 0-dependency native binary executable of ~120Kb.
- Only takes 1 argument thats the email that you want the avatar from, filename will be the email.
$ nim c -d:release -d:ssl libravatar.nim
$ ./libravatar "[email protected]"
$ file "[email protected]"
[email protected]: JPEG image data, JFIF standard 1.0, resolution (DPI), precision 8, 128x128
Feature | Libravatar | Gravatar |
---|---|---|
JPEG and PNG support | Yes | Yes |
GIF support | Yes | No |
Upload size limit | 10 MB | ??? |
Image size (in pixels) | 1 to 512 | 2048 |
HTTPS support | Yes | Yes |
IPv6 support | Yes | No |
Supported email hashes | MD5, SHA256 | MD5 only |
OpenID URL support | Yes | No |
Redirection to Gravatar | Yes | No |
Customizable default image | Yes | Yes |
MPAA-style image ratings (Adult Content, Nude, Porn) | G-Rated only (No Porn) | Yes |
Text-based profile information | No | Yes |
Federation via DNS SRV records | Yes | No |
LDAP authentication | Yes | No |
OpenID authentication | Yes | No |
Automatic photo importers | Yes | No |
Translated user interface | Yes | Yes |
Account export | Yes | No |
Account deletion | Yes | No |
XML-RPC API | No | Yes |
Libraries/plugins available | Yes | Yes |
Free and Open Source software | Yes | No |
Distributed service | Community mirrors | Commercial Proprietary |
Corporate owner | No | Automattic |