Displaying 1 result from an estimated 1 matches for "convert_to_png".
Did you mean:
convert_to_long
2005 Nov 16
0
image conversion w/ file column
...s because 50x50 is pretty small and png would be a
much better format (in smaller dimensions) than jpg or gif.
This is what i have in my model (using rmagick for the conversion):
file_column :image, :magick => {:versions => { "thumb" => "50x50" }}
before_validation :convert_to_png
def convert_to_png
if self.image_just_uploaded?
imgpath = self.image()
img = ImageList.new(imgpath)
imgpath = imgpath.sub(/(jpg)$/, ''png'')
img.write(imgpath)
end
end
Which manages to save a png version of the original image in the final
dir bu...