Socket
Book a DemoInstallSign in
Socket

buddies_avatar

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buddies_avatar

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

UNDER DEVELOPMENT

What does it do?

Part of the 'buddies' gem that aims to bring some common social features to a rails site. Buddies avatar gem provides user avatar and cropping feature. Image cropping technique is credited to railscasts.com

Setup to use rackspace

  • Add fog gem
  • Overwrite user

user.rb

class User ...

  # For crop only, avatar_geometry opens it
  def avatar_rackspace_path
    "http://#{RACKSPACE_CONFIG[:uploads_url]}/" + avatar.current_path
  end

  def avatar_upload_path
    if Rails.env.test? or Rails.env.cucumber?
      super
    else
      avatar_rackspace_path
    end
  end
  
end
  • Setup carrierwave initializer

Load rackspace.yml

RACKSPACE_CONFIG = YAML.load(File.read("#{Rails.root}/config/rackspace.yml"))[Rails.env].symbolize_keys

config/initializers/carrierwave.rb

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider           => 'Rackspace',
    :rackspace_username => RACKSPACE_CONFIG[:username],
    :rackspace_api_key  => RACKSPACE_CONFIG[:api_key]
  }
  config.fog_directory = RACKSPACE_CONFIG[:uploads_dir]
  config.fog_host = "http://#{RACKSPACE_CONFIG[:uploads_url]}"
end

avatar_uploader

storage :fog unless Rails.env.test? or Rails.env.cucumber?

This project rocks and uses MIT-LICENSE.

FAQs

Package last updated on 17 Sep 2011

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.