Home

Awesome

Demo

avatarly

Gem Version Build Status

avatarly is a simple gem for creating gmail-like user avatars based on user email or any other string passed

inspired and influenced by https://github.com/johnnyhalife/avatar-generator.rb

Demo

http://avatarly.herokuapp.com

Installation

Avatarly requires ImageMagick to be installed.

Gems

The gems are hosted at Rubygems.org. Make sure you're using the latest version of rubygems:

$ gem update --system

Then you can install the gem as follows:

$ gem install avatarly

Bundler

Add to your Gemfile:

gem "avatarly"

and then type:

bundle install

Usage

To generate image please do:

Avatarly.generate_avatar(text, opts={})

the only required parameter is <tt>text</tt>. Other options that you can pass are:

As a result you will get an image blob - rest is up to you, do whatever you want with it.

For instance you can store avatar in directory with images:

  img = Avatarly.generate_avatar(text, opts={})
  File.open('public/images/avatar_name.png', 'wb') do |f|
    f.write img
  end

License

MIT

Maintainers and support

Thanks for help with the project:

Knapsack Pro logo Knapsack Pro - learn how to speed up Ruby and JavaScript tests with CI parallelisation