Watermark with Ruby on Rails

To whom it may concern, a way to create watermarks with ruby on rails,
imagemagick, attachment_fu and mini-magick in Portuguese, but the code
is in
English;)

http://www.woompa.blog.br/2010/07/14/adicionando-marca-dagua-nas-suas-imagens-com-imagemagick-e-mini-magick/

Tnks!

Well, another way is to do it within the paperclip plugin when files
get uploaded.

It goes a lil’ something like this:

----------- start extract ---------
require ‘paperclip’

class Image < ActiveRecord::Base
belongs_to :parts

has_attached_file :info,
:processors => [:watermark],
:styles => {
:mini => “60x60#”,
:thumb => “160x160#”,
:medium => {
:geometry => “600>”,
:watermark_path => “#{RAILS_ROOT}/public/images/logo.png”,
:position => “SouthEast”
},
:original => “1x1”
}

validate :check_content_type

def check_content_type
if ![‘image/jpeg’, ‘image/pjpeg’, ‘image/x-png’, ‘image/gif’,
‘image/png’].include?(self.info_content_type)
errors.add( ‘attachment,’, “’#{self.info_file_name}’ is not a
valid image type”)
end
end

end

----------- end extract ---------

gordon Yeong