An open API service indexing awesome lists of open source software.

https://github.com/juancarlospaco/nim-libravatar

Libravatar library for Nim, Gravatar alternative. Libravatar is an open source free federated avatar api & service.
https://github.com/juancarlospaco/nim-libravatar

avatar-api avatar-generator avatar-service federated gravatar gravatar-api libravatar nim nim-lang nim-language ppl-license

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# Nim-Libravatar

[Libravatar](https://www.libravatar.org) library for [Nim](https://nim-lang.org/learn.html), Gravatar alternative. Libravatar is an open source federated avatar api and service.

![](https://img.shields.io/github/languages/top/juancarlospaco/nim-libravatar?style=for-the-badge)
![](https://img.shields.io/github/languages/count/juancarlospaco/nim-libravatar?logoColor=green&style=for-the-badge)
![](https://img.shields.io/github/stars/juancarlospaco/nim-libravatar?style=for-the-badge "Star nim-libravatar on GitHub!")
![](https://img.shields.io/github/languages/code-size/juancarlospaco/nim-libravatar?style=for-the-badge)
![](https://img.shields.io/github/issues-raw/juancarlospaco/nim-libravatar?style=for-the-badge "Bugs")
![](https://img.shields.io/github/issues-pr-raw/juancarlospaco/nim-libravatar?style=for-the-badge "PRs")
![](https://img.shields.io/github/last-commit/juancarlospaco/nim-libravatar?style=for-the-badge "Commits")

# 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

- `nimble install libravatar`
- [You can create an account for free, it only needs an email.](https://www.libravatar.org/accounts/new/)

# Use

```nim
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
```

# 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 "[email protected]"
$ file "[email protected]"
[email protected]: 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](https://starchart.cc/juancarlospaco/nim-libravatar.svg "Star nim-libravatar onGitHub!")