Search code examples
ruby-on-railsrubygemscarrierwavermagick

Adding text to posters with RMagick and Carrierwave. uninitialized constant PhotoUploader::Draw


I am trying to do image manipulation as process to add some text to my app. The effect I'm looking for is : adding text to image, after saving. The problem I'm dealing here is I get error: uninitialized constant PhotoUploader::Draw.

photo_uploader.rb

process :poster

def poster
 manipulate! do |source|
  txt = Draw.new
  txt.family
  txt.pointsize = 12
  txt.gravity = Magick::SouthGravity
  txt.stroke = "#000000"
  title = Demot.last.title
  source = source.resize_to_fill(400, 400).border(10, 10, "black")
  source.annotate(txt, 0, 0, 0, 40, title)

end

end


Solution

  • Change to

    txt = Magick::Draw.new