Class: Image
Instance Method Summary collapse
- #find_dimensions ⇒ Object
-
#validate ⇒ Object
if there are errors from the plugin, then add a more meaningful message.
Instance Method Details
#find_dimensions ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/image.rb', line 11 def find_dimensions temporary = .queued_for_write[:original] filename = temporary.path unless temporary.nil? filename = .path if filename.blank? geometry = Paperclip::Geometry.from_file(filename) self. = geometry.width self. = geometry.height end |
#validate ⇒ Object
if there are errors from the plugin, then add a more meaningful message
21 22 23 24 25 26 27 28 |
# File 'app/models/image.rb', line 21 def validate unless .errors.empty? # uncomment this to get rid of the less-than-useful interrim messages # errors.clear errors.add :attachment, "Paperclip returned errors for file '#{}' - check ImageMagick installation or image source file." false end end |