Paperclip - exclude zip, rar from cropping
I have an Attachment
model, which is using Paperclip
to handle uploaded files. The file can be anything an image, a txt, doc, pdf, rar, zip, tar etc.
This is a nice solution:
before_post_process :image?
def image?
!(data_content_type =~ /^image.*/).nil?
end
You can also use the image? method in your views to either render an image_tag, or something else...
精彩评论