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;)
Tnks!
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;)
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs