views:

57

answers:

2

How do I tell Paperclip not to save the original file when it is uploaded? Or even better, to store a scaled version of the file as the original?

A: 

Paperclip always saves an original by default, but I 'believe', that if you just remove it from your migration then it will not try and save it.

I save a scaled original on my model so that users can edit their image later. My model looks like this :

:styles => { :cropped_thumb => {:geometry => "115x70#", :jcrop => true}, :resized_thumb => {:geometry => "115x70>"}, :deal => {:geometry => "64x56#"},  
:cropped_large => {:geometry => "#{PHOTO_IMAGE_WIDTH}x#{PHOTO_IMAGE_HEIGHT}#", :jcrop => true},
:resized_large => {:geometry => "#{PHOTO_IMAGE_WIDTH}x#{PHOTO_IMAGE_HEIGHT}>"},

:orig => '300x168>',  #this is the scaled original that I call later


:cropped_orig => {:geometry => '300x168#', :jcrop => true},
:resized_orig => {:geometry => '300x168>'} },
:processors => [:jcropper]
Trip
Thanks for your response, Trip.
Jade
A: 

I believe that you can simply define a style for :original to have paperclip replace the original with that size.

:styles => { :original => '300x168>', :cropped_thumb => {:geometry => "115x70#", :jcrop => true}, ...}
Chris G.
Awesome. Thank you, Chris. I can't believe I overlooked that.
Jade