https://github.com/loopj/initials-avatar
Generate an avatar image from a user's initials, ideal for use as a meaningful gravatar fallback.
https://github.com/loopj/initials-avatar
Last synced: about 1 year ago
JSON representation
Generate an avatar image from a user's initials, ideal for use as a meaningful gravatar fallback.
- Host: GitHub
- URL: https://github.com/loopj/initials-avatar
- Owner: loopj
- License: mit
- Created: 2014-07-12T21:27:21.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-07-12T23:39:48.000Z (almost 11 years ago)
- Last Synced: 2025-04-15T03:55:46.745Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 201 KB
- Stars: 43
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Initials Avatar
---------------
Generate an avatar image from a user's initials, ideal for use as a meaningful gravatar fallback. For example:
## Usage
### Basic Usage
Generate a 100x100 avatar for the initials *JD*:
```
http://initials.me/jd
```

### Specifying Size
Generate an 50x50 avatar for the initials *JS*:
```
http://initials.me/js?s=50
```

### Specifying Colors
Generate an avatar with custom foreground/background colors:
```
http://initials.me/js?s=50&fg=336699&bg=ffcc00
```

### Use as a Gravatar Fallback
Show the [Gravatar](http://gravatar.com) 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
```
## Dependencies
This app requires [ImageMagick](http://www.imagemagick.org/) and [Ghostscript](http://www.ghostscript.com/) to be installed:
### Mac
```shell
$ brew install imagemagick ghostscript
```
### Ubuntu
```shell
$ sudo apt-get install ruby-dev libmagickwand-dev imagemagick
```
## Installation
```shell
bundle install
```
## Starting the Server
### Rackup
For running locally, I recommend using the `rackup` command:
```shell
$ rackup
```
### Docker
You can run this in production using [Docker](https://docker.com) as follows:
```shell
$ docker pull loopj/initials-avatar
$ docker run -p 80:80 loopj/initials-avatar
```
### Mounting Under a Rails App
If you'd like to run this from inside an existing rails app, you can mount it as follows in `config/routes.rb`:
```ruby
match "/initials-avatar" => InitialsAvatar, :anchor => false
```
You can then access avatars at /initials-avatar/:initials from your rails app.