Class: Spree::Image
- Defined in:
- app/models/spree/image.rb
Instance Method Summary collapse
- #find_dimensions ⇒ Object
-
#mini_url ⇒ Object
used by admin products autocomplete.
-
#no_attachment_errors ⇒ Object
if there are errors from the plugin, then add a more meaningful message.
Methods inherited from Base
Methods included from Preferences::Preferable
#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#find_dimensions ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/models/spree/image.rb', line 24 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 |
#mini_url ⇒ Object
used by admin products autocomplete
20 21 22 |
# File 'app/models/spree/image.rb', line 20 def mini_url .url(:mini, false) end |
#no_attachment_errors ⇒ Object
if there are errors from the plugin, then add a more meaningful message
34 35 36 37 38 39 40 41 |
# File 'app/models/spree/image.rb', line 34 def 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 |