RMagick resize before manipulation

I have to upload an image and create a thumb version of it. Also I want
to create a watermark, but the problem is how to watermark it after
resizing, so on my thumb version there is no watermark, but on original
there is.

class ImageUploader < CarrierWave::Uploader::Base

include CarrierWave::RMagick

storage :file

def store_dir
“uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}”
end

version :thumb do
process :resize_to_fill => [300, 200]
end

process :copyright=>'Copyright ’

def copyright(str)
manipulate! format: “jpg” do |source|
mark = Magick::Image.new(source.columns, source.rows)
gc = Magick::Draw.new
gc.gravity = Magick::NorthEastGravity
gc.pointsize = 20
gc.font_weight = Magick::BoldWeight
gc.stroke = ‘none’
gc.annotate(mark, 0, 0, 0, 0, str)
mark = mark.shade(true, 310, 30)
source.composite!(mark, Magick::CenterGravity,
Magick::HardLightCompositeOp)
end
end

end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs