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.
- Host: GitHub
- URL: https://github.com/juancarlospaco/nim-libravatar
- Owner: juancarlospaco
- License: other
- Created: 2019-02-24T07:22:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-14T20:24:46.000Z (about 4 years ago)
- Last Synced: 2025-01-26T14:48:41.371Z (3 months ago)
- Topics: avatar-api, avatar-generator, avatar-service, federated, gravatar, gravatar-api, libravatar, nim, nim-lang, nim-language, ppl-license
- Language: Nim
- Homepage: https://www.libravatar.org
- Size: 30.3 KB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
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.






# 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
