Skip to content

Libravatar library for Nim, Gravatar alternative. Libravatar is an open source free federated avatar api & service.

License

Notifications You must be signed in to change notification settings

juancarlospaco/nim-libravatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nim-Libravatar

Libravatar library for Nim, Gravatar alternative. Libravatar is an open source federated avatar api and service.

Features

  • 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 :)

Install

Use

import libravatar
var email = "me@aaronsw.com"
getLibravatarUrl(email)
echo email
email = "me@aaronsw.com"
getLibravatarUrl(email, size=512, default="monsterid")
echo email
email = "me@aaronsw.com"
getLibravatarUrl(email, size=9, default="404", baseUrl="https://MyCustomFederatedServer.org/avatar/")
echo email

Libravatar App

  • 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 "me@aaronsw.com"
$ file "me@aaronsw.com.jpg"
me@aaronsw.com.jpg: JPEG image data, JFIF standard 1.0, resolution (DPI), precision 8, 128x128

Libravatar Vs Gravatar

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

Stars

Star nim-libravatar on GitHub