Class: Spree::PageImage

Inherits:
Asset
  • Object
show all
Defined in:
app/models/spree/page_image.rb

Instance Method Summary collapse

Instance Method Details

#attachment_sizesObject



17
18
19
20
21
22
23
24
# File 'app/models/spree/page_image.rb', line 17

def attachment_sizes
  sizes = {}
  if image_content?
    sizes.merge!(:mini => '48x48>', :small => '150x150>', :medium => '420x300>', :large => '900x650>')
    sizes.merge!(:slide => '950x250#') if viewable.respond_to?(:root?) && viewable.root?
  end
  sizes
end

#image_content?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/spree/page_image.rb', line 13

def image_content?
  attachment_content_type.to_s.match(/\/(jpeg|png|gif|tiff|x-photoshop)/)
end