Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make carrierwave not save the original file after versions are processed?

I'm using CarrierWave for my file uploads in Rails 3.1, and I'm looking for a way to save server space. Many of the photos being uploaded are upwards of 20MB, so after processing them down to 1024 x 1024, I would like to remove the original. Is there any easy way to do that in the uploader class?

Thanks, --Mark

like image 712
Mark Avatar asked Dec 20 '11 17:12

Mark


1 Answers

I used to have two versions and realized that I did not not need the original

So instead of having

version :thumb do
    process :resize_to_limit => [50, 50]
  end

version :normal do
   process :resize_to_limit => [300,300]
end

I removed :normal and added this

process :resize_to_limit => [300, 300]

Now the original is saved in size I need and I don't have a third unused image on the server

like image 191
Jepzen Avatar answered Nov 01 '22 08:11

Jepzen