Class: PressImage

Inherits:
Image
  • Object
show all
Defined in:
app/models/press_image.rb

Instance Method Summary collapse

Instance Method Details

#attachment_sizesObject



24
25
26
27
28
29
30
# File 'app/models/press_image.rb', line 24

def attachment_sizes
  if image_content?
    { :mini => '48x48>', :small => '150x150>', :medium => '600x600>', :large => '950x700>' }
  else
    {}
  end
end

#image_content?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/models/press_image.rb', line 20

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

#no_attachement_errorsObject



32
33
34
35
36
37
38
39
# File 'app/models/press_image.rb', line 32

def no_attachement_errors
  unless attachment.errors.empty?
    # uncomment this to get rid of the less-than-useful interrim messages
    # errors.clear
    errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file."
    false
  end
end