3

Having inside my uploader:

version :profile do
    process :resize_to_fill => [300, 300]
    process :quality => 90
    process :watermark
  end

then :

  def watermark
    manipulate! do |img|
      logo = Magick::Image.read("#{Rails.root}/assets/images/watermarks/watermark.png").first
      img = img.composite(logo, Magick::SouthEastGravity, Magick::OverCompositeOp)
    end
  end
  • above won't work while imagemagick is installed
  • there is no error logging so very very hard to debug

  • is there a way to debug and fix above code to make a working watermark method for carrierwave?

Rubytastic
  • 15,001
  • 18
  • 87
  • 175

1 Answers1

5

Where's the line where you write the result to disk?

I believe the composite method itself doesn't write the result to disk. You have to call img.write('composite.gif') (or whatever filename you want) in order to actually save the result of the composite.

I suppose it's possible that carrierwave does this for you, but can you verify that by checking the output contents of the file and/or timestamps to see if the file was modified after upload?

Ref: http://rmagick.rubyforge.org/src_over.html - about half way down the page

jefflunt
  • 33,527
  • 7
  • 88
  • 126