Guest User

Untitled

a guest
Apr 27th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. class Photo < ActiveRecord::Base
  2. has_attachment :content_type => :image,
  3. :storage => :file_system,
  4. :resize_to => '800x600>',
  5. :thumbnails => { :thumb => '80x80>', :main => '375x375>'},
  6. :processor => :rmagick
  7.  
  8. validates_as_attachment
  9.  
  10. def resize_image(img, size)
  11. self.temp_path = write_to_temp_file(img.to_blob {self.quality = 30})
  12. end
  13. end
Add Comment
Please, Sign In to add comment