views:

633

answers:

2

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
This post is dead. Could you please paste the solution on here?
Trevor Hartman
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
Thanks for the comment, it's apreciated
kristian nissen