views:

49

answers:

1

I'm using Paperclip and s3 to upload a simple Image file on article. I've browse all these tutorials explaining on how to actually make a delayed job, for the images, but i feel that they're too old and perhaps there's an easier way to accomplish this. My question is, what's the "rails" (quick and easy) of accomplishing an flash/ajax upload for a picture of an article model with the following specs.

1 - Only 1 photo is going to be uploaded per article.

2 - The paperclip model handles 2 resizes of original; Thumb which is 120x120 and Normal which is 250x250

And what should i use to "AJAXify" the upload?

Thank you very much!

+2  A: 

There are a couple of popular javascript upload handlers which will display upload progress and can resize the original image prior to upload. Plupload and swfupload. Looking for a swfupload url their site is down so maybe plupload is a better bet.

You should still use delayed job as it means the user doesn't need to wait for your server to reprocess the image on s3, after their internet connection has sent it to your server. It's very simple to set up, in fact, there's a delayed_paperclip plugin which handles it all for you.

edit:

Here's a couple of gems that should make swfupload installation easier.

swfupload rails 2 gem

swfupload rails 3 gem

Also a good tutorial on flash upload with session. Be sure to read updates toward end.

mark
I haven't seen Pupload before. swfupload I haven't got to work with rails.
Sam
I edited in a couple of gems which should make swfupload intergration simple, though the rails 2 is dated it should work ok.
mark