Skip to content

Instantly share code, notes, and snippets.

@daniel-nelson
Created June 21, 2011 19:27
Show Gist options
  • Save daniel-nelson/1038658 to your computer and use it in GitHub Desktop.
Save daniel-nelson/1038658 to your computer and use it in GitHub Desktop.
class ImageWidget < ContentWidget
has_attached_file :image,
:styles => lambda { |a|
{ :thumb => '200x100>',
:display => "#{a.instance.width}x#{a.instance.height}#" }
},
:storage => PAPERCLIP_CONFIG[:storage],
:bucket => PAPERCLIP_CONFIG[:bucket],
:s3_host_alias => PAPERCLIP_CONFIG[:bucket],
:s3_credentials => {
:access_key_id => AWS_S3[:access_key_id],
:secret_access_key => AWS_S3[:secret_access_key]
},
:path => PAPERCLIP_CONFIG[:path_prefix] + ':image_path_prefix/images/:style/:id.png',
:command_path => PAPERCLIP_CONFIG[:command_path]
# :url => ':s3_alias_url',
def image_path_prefix
site.subdomain
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment