Skip to content

Instantly share code, notes, and snippets.

@stve
Created February 2, 2010 00:50
Show Gist options
  • Save stve/292236 to your computer and use it in GitHub Desktop.
Save stve/292236 to your computer and use it in GitHub Desktop.
PAPERCLIP_CONFIG = {}
AMAZON_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/amazon_s3.yml")[RAILS_ENV]
PAPERCLIP_CONFIG = {
:path => ":class/:attachment/:id/:style/:basename.:extension",
:storage => :s3,
:s3_credentials => AMAZON_CONFIG,
:s3_permissions => 'public-read',
:bucket => AMAZON_CONFIG['bucket'],
:s3_host_alias => AMAZON_CONFIG['bucket'],
:url => ":s3_alias_url"
}
class User < ActiveRecord::Base
has_attached_file :avatar, {
:url => "/system/users/:attachment/:id/:style/:basename.:extension",
:path => ":rails_root/public/system/users/:attachment/:id/:style/:basename.:extension",
:styles => { :thumb => ['48x48#', :png], :large => ['125x125#', :png] },
:default_url => "/images/avatars/user/default_:style.jpg"
}.merge(PAPERCLIP_CONFIG)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment