File_column, RMagick, and watermarking

FlexImage seems great, but i would prefer to story my images on disk
rather than in the DB.... thats not possible with FlexImage, is it?

I totally forgot I posted this. I figured it out with RMagick a long time ago… it’s pretty simple actually

This places “sample” diagonally across the middle of the image. You needa graphic called 'sample.png
’ that contains some alpha transparency but that’s easy to create.

class Photo < ActiveRecord::Base

file_column :filename, :magick => {
  :versions => { "thumb" => "50x50", "large" => "320x240>" }

  }

validates_presence_of :filename, :description
before_create :watermark_image

private
def watermark_image
    require 'RMagick'  # probably don't need this line but it's here anyway

    dst = Magick::Image.read(self.filename).first
    src = Magick::Image.read("#{RAILS_ROOT}/config/sample.png").first
    result = dst.composite(src, Magick::CenterGravity, Magick::OverCompositeOp)

    result.write(self.filename)

end

end