waynehoover / s3_direct_upload

Direct Upload to Amazon S3 With CORS
MIT License
651 stars 333 forks source link

Create Thumbnail Version (Carrierwave)? #132

Open kylerenke opened 10 years ago

kylerenke commented 10 years ago

Is it possible to create a thumbnail version when uploading directly to s3_direct_upload? Perhaps integrating carrierwave somehow? I'm not quite sure how I would do this, however. Any ideas on how to do something like this?

version :thumb do
    process resize_to_fill: [200, 200]
  end
weavermedia commented 10 years ago

There's a good tutorial for post-processing via Paperclip which is similar to Carrierwave, you might be able to adapt the info. I'm currently using the Paperclip method and I'm fairly happy with it.

Files are uploaded via s3_direct_upload then the callback supplies the URL to the model which then checks if the file is an image and requires resizing. If so the Paperclip downloads the original, produces the thumbnails etc and then save them back to S3.

designstuhl commented 6 years ago

You might want to check out Episode #182 on rails casts pro (all vids are free now). In this episode he deals with uploading, cropping, and resizing images along with providing a preview during the process using CarrierWave.

Granted he does not use s3_direct_upload in his example, but this might give you some insight as to how you can accomplish what you are asking about.

I realize this original post is now 4 years old but it might still be useful information for others.

RailsCast Episode 182 (revised) https://www.youtube.com/watch?v=ltoPZEzmtJA