I'm using paperclip for uploading files, handling images is easy, but how can I handle images (png, jpg) and swf in the same upload, even pdf files, when I have to create different styles of the images but not the other formats.
A:
Here you go, a bit of ragged post but the idea is working quiet well http://www.mrkris.com/2009/09/15/paperclip-before%5Fprocess-for-your-habitual-pornographic-needs/
Elad Meidar
2009-10-16 05:55:21
This post is dead. Could you please paste the solution on here?
Trevor Hartman
2010-10-25 19:42:53
A:
Although the accepted answer is dead, it looks like the solution is:
before_post_process :is_image?
def is_image?
!(asset_content_type =~ /^image/).nil?
end
Assuming your attachment is named asset
. Modify as necessary.
Trevor Hartman
2010-10-25 19:44:08