Sha256: befdc2d149a9368c9337720ab5c4ce1993b44389b6b1143ebd0099e1af4fae20

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

## 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.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
buddies_avatar-0.0.2 README.md
buddies_avatar-0.0.1 README.md