Sha256: 8876eafa998b94dc9a2ab0b4107c59f1546804f27c1a8a34bc34f36e27c147c6

Contents?: true

Size: 1.15 KB

Versions: 18

Compression:

Stored size: 1.15 KB

Contents

class Picture < Document
  has_attached_file :file, 
                    :url => '/:class/:id.:extension',
                    :path => ':rails_root/documents/:class/:id_partition/:style',
                    :styles => {:thumb48sq  => ["48x48"],
                                :thumbwall => ["130x97#"],
                                # midwall preserves A4 proportion: 210x297
                                :midwall => ["80x113#"],
                                :preview => ["500>"]
                               }                              
                               
  define_index do
    activity_object_index

    indexes file_file_name, :as => :file_name
  end    

  # Thumbnail file
  def thumb(size, helper)
    case size
      when 16
        "#{ size.to_s }/photo.png"
      when 48
        helper.picture_path self, :format => format, :style => 'thumb48sq'
      when 80
        helper.picture_path self, :format => format, :style => 'midwall'
      when 130
        helper.picture_path self, :format => format, :style => 'thumbwall'
      when 500
        helper.picture_path self, :format => format, :style => 'preview'
    end
  end
      
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
social_stream-0.29.0 documents/app/models/picture.rb
social_stream-documents-0.17.0 app/models/picture.rb
social_stream-0.28.4 documents/app/models/picture.rb
social_stream-documents-0.16.1 app/models/picture.rb
social_stream-0.28.1 documents/app/models/picture.rb
social_stream-0.28.0 documents/app/models/picture.rb
social_stream-documents-0.16.0 app/models/picture.rb
social_stream-0.27.3 documents/app/models/picture.rb
social_stream-0.27.2 documents/app/models/picture.rb
social_stream-0.27.1 documents/app/models/picture.rb
social_stream-documents-0.15.1 app/models/picture.rb
social_stream-0.27.0 documents/app/models/picture.rb
social_stream-documents-0.15.0 app/models/picture.rb
social_stream-0.26.2 documents/app/models/picture.rb
social_stream-0.26.1 documents/app/models/picture.rb
social_stream-documents-0.14.1 app/models/picture.rb
social_stream-0.26.0 documents/app/models/picture.rb
social_stream-documents-0.14.0 app/models/picture.rb