Created
March 20, 2010 05:48
-
-
Save alexkojin/338503 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Photo < ActiveRecord::Base | |
has_attached_file :file, | |
:storage => :s3, | |
:s3_credentials => "#{Rails.root}/config/s3_credentials.yml", | |
:bucket => 'hdphotos', | |
:path => ":uid/:id/:token_:style.:extension", | |
:styles => {:thumb => '189x189#', :cover => '379x379#', :hd => '912x720>'}, | |
:convert_options => { :all => '-strip -colorspace RGB' } | |
belongs_to :user | |
belongs_to :album, :counter_cache => true | |
after_post_process :define_sizes | |
private | |
def define_sizes | |
self.thumb_file_size = self.file.queued_for_write[:thumb].size | |
self.cover_file_size = self.file.queued_for_write[:cover].size | |
self.hd_file_size = self.file.queued_for_write[:hd].size | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment