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
On Jul 15, 1:27 am, Marcus Sá <[email protected]> wrote:
> 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...
>
> Tnks!
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.