Generate an avatar image from a user's initials, ideal for use as a meaningful gravatar fallback. For example:
Generate a 100x100 avatar for the initials JD:
http://initials.me/jd
Generate an 50x50 avatar for the initials JS:
http://initials.me/js?s=50
Generate an avatar with custom foreground/background colors:
http://initials.me/js?s=50&fg=336699&bg=ffcc00
Show the Gravatar for a particular user, and fallback to showing their initials (JD) if the Gravatar doesn't exist:
http://www.gravatar.com/avatar/00000000000000000000000000000000?d=http%3A%2F%2Finitials.me%2FJD
This app requires ImageMagick and Ghostscript to be installed:
$ brew install imagemagick ghostscript
$ sudo apt-get install ruby-dev libmagickwand-dev imagemagick
bundle install
For running locally, I recommend using the rackup
command:
$ rackup
You can run this in production using Docker as follows:
$ docker pull loopj/initials-avatar
$ docker run -p 80:80 loopj/initials-avatar
If you'd like to run this from inside an existing rails app, you can mount it as follows in config/routes.rb
:
match "/initials-avatar" => InitialsAvatar, :anchor => false
You can then access avatars at /initials-avatar/:initials from your rails app.