Class: Image
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Image
- Defined in:
- app/models/image.rb
Overview
Schema Information
Table name: images
id :integer(4) not null, primary key created_at :datetime updated_at :datetime photo_file_name :string(255) photo_content_type :string(255) photo_file_size :integer(4) photo_updated_at :datetime content_element_image_id :integer(4) deleted_at :datetime
Instance Method Summary
Instance Method Details
- (Object) absolute_url
34 35 36 |
# File 'app/models/image.rb', line 34 def absolute_url "#{Settings.website.base_url}#{photo.url}" end |
- (Object) file_size
42 43 44 45 46 47 48 49 |
# File 'app/models/image.rb', line 42 def file_size file_size = self.photo_file_size if (file_size/1024) < 1024 (file_size/1024).to_s + " KB" else (file_size/(1024*1024)).to_s + " MB" end end |
- (Object) name
30 31 32 |
# File 'app/models/image.rb', line 30 def name self.photo_file_name.gsub(/[.][a-zA-Z]*/,"") end |
- (Object) tag
38 39 40 |
# File 'app/models/image.rb', line 38 def tag "<img alt=\"#{photo_file_name}\" src=\"#{Settings.website.base_url}#{photo.url}\" />" end |