watermark with paperclip

后端 未结 1 1889
眼角桃花
眼角桃花 2021-01-03 16:51

according to this example (http://dimaspriyanto.com/2010/06/08/image-watermarking-with-paperclip/), I try to put a watermark on every picture I upload (for now, I restrain m

相关标签:
1条回答
  • 2021-01-03 17:08

    Here's the preprocessor that works (I use it) https://gist.github.com/2499137

    Here's sample code for you model:

    has_attached_file :data,
                      :processors => [:watermark],
                      :url  => "/ckeditor_assets/pictures/:id/:style_:basename.:extension",
                      :path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension",
                      :styles => {
                        :thumb => '118x100#',
                        :content => {
                          :geometry => '700>',
                          :watermark_path => "#{Rails.root}/public/images/watermark.png",
                          :position => 'SouthWest'
                        },
                      }
    
    0 讨论(0)
提交回复
热议问题