Question

I'm trying to put text on an image via carrierwave and mini_magic. The code runs without erros, but the resulting image has no text on it.

version :text do
   process :put_text_stamp
end

def put_text_stamp
  manipulate! do |img|
    img.combine_options do |c|
      c.gravity 'Center'
      c.fill 'red'
      c.pointsize '22'
      c.draw "text 0,0 'TEXT'"
    end
    img = yield(img) if block_given?
    img
  end
end
Was it helpful?

Solution

Hi just this morning I encountered the same problem, I'm still on rails 3.2 but this one worked fine for me. I guess its something with your yield function.

  process :resize_to_limit => [800, 800]
  process :add_text

  def add_text
    manipulate! do |image|
      image.combine_options do |c|
        c.gravity 'Center'
        c.pointsize '22'
        c.draw "text 0,0 'test'"
        c.fill 'white'
      end
      image
    end    
  end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top