New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

initial_avatar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

initial_avatar

  • 0.2.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Initial Avatar

Create Gmail like text avatars.

Installation

Add this line to your application's Gemfile:

gem 'initial_avatar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install initial_avatar

Usage

CarrierWave example:

class ProfileImageUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  def default_url
    InitialAvatar.avatar_data_uri(model.name[0], size: 100, font_size: 70)
  end

  version :thumb do
    process resize_to_fill: [100, 100]
  end
end

Configuration

In config/initializers/initial_avatar.rb, you can configure the following values.

InitialAvatar.configure do |config|
#   config.colors = %w[
#     #1abc9c #16a085 #f1c40f #f39c12 #2ecc71 #27ae60 #e67e22 #d35400 #3498db
#     #2980b9 #e74c3c #c0392b #9b59b6 #8e44ad #bdc3c7 #34495e #2c3e50 #95a5a6
#     #7f8c8d #ec87bf #d870ad #f69785 #9ba37e #b49255 #b49255 #a94136
#   ]
#   config.text_color = '#ffffff'
#   config.size = 100
#   config.font_weight = 400
#   config.font_family = 'HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica, Arial,Lucida Grande, sans-serif'
#   config.seed = 0
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/aki77/initial_avatar. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 25 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc