Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails, Paperclip and S3. Avoid saving the original image?

I am using Paperclip + s3 for image attachment. Is there a way to only store the styles and not the original image(in an attempt to reduce attachment save time and save storage space)?

I have seen a couple of post which suggest to use original as one of the style. It is not possible for me to do so, as i need the original to act as a reference for cropping. Link to one such post: How do I tell paperclip to not save the original file?

And also it is not possible to save original & delete it later as it kind of defeats the purpose.

Is there a setting which I am missing?

Thank you in advance.

like image 932
Subramaniam Avatar asked Nov 11 '22 11:11

Subramaniam


1 Answers

There's a good resource here: Rails and Paperclip... don't save the original image, just the styles?

Delayed

In light of your findings & comment, you may wish to move the image processing to a backend job? Although I've not done this myself, there are resources such as the delayed_paperclip gem which allow you to push the processing part of Paperclip to a backend job


System

A note on system setup - I would personally accomodate the original image. If you're quibbling over storage space, unless you're facebook or instagram, your image space is not going to cause a big problem, especially considering S3 pricing is based on TB

like image 199
Richard Peck Avatar answered Dec 08 '22 00:12

Richard Peck