class ArticlePhotoUploader

Public Instance Methods

crop() click to toggle source
# File lib/buweb/uploaders/article_photo_uploader.rb, line 50
def crop
  if model.try(:crop_x).present?
    manipulate! do |img|
      x = model.crop_x.to_i
      y = model.crop_y.to_i
      w = model.crop_w.to_i
      h = model.crop_h.to_i
      img.crop("#{w}x#{h}+#{x}+#{y}")
      img
    end
  end
end
extension_white_list() click to toggle source

Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:

# File lib/buweb/uploaders/article_photo_uploader.rb, line 9
def extension_white_list
  %w(jpg jpeg png)
end