Topic: Paperclip: Adding a little black band in the picture footer

Hello Guys.

I'm trying to add a little black band with some text on the footer of an uploaded picture but i'm having problems, could someone give me the right way to go there?

In my model, i inserted:

:convert_options => { :large => "-background black -fill white -pointsize 28 label:'llalalalalaal' -gravity Center " }

it uploads the image, but nothing happens, it doesnt add the band at the picture, and instead " llalalalalaal" in label, i would like to use the name of the owner of the picture, which is set during the process of upload.

Can someone help?


My full model code:

require 'watermark'

class Foto < ActiveRecord::Base
  validates_attachment_presence :foto
  validates_attachment_size :foto, :less_than => 5.megabytes
  validates_attachment_content_type :foto, :content_type => ['image/jpeg', 'image/png'], :message => 'precisa ser jpg ou png ze'
  before_create :randomize_file_name
  has_attached_file :foto,

    :url => "../albuns/:attachment/:id_partition/:basename_:style.:extension",
    :path => ":rails_root/public/albuns/:attachment/:id_partition/:basename_:style.:extension",

    :processors => [:watermark],
    :quality => "better",

    :styles => {

    :thumb => {
      :geometry => "200x120>"
    },

    :small => {
      :geometry => "1024x768>",
      :watermark_path => "#{RAILS_ROOT}/public/images/marcadagua.png",
      :position => "SouthWest"
    },
    :large => {
      :geometry => "1600x1200>",
      :watermark_path => "#{RAILS_ROOT}/public/images/marcadagua.png",
      :position => "SouthEast"
    }
  },
:convert_options => { :large => "-background black -fill white -pointsize 28 label:'llalalalalaal' -gravity Center" }


  private

  def randomize_file_name
    return if foto_file_name.nil?
    extension = File.extname(foto_file_name).downcase
    if foto_file_name_changed?
      self.foto.instance_write(:file_name, "#{ActiveSupport::SecureRandom.hex(16)}#{extension}")
    end
  end

end

Thanks for any help.

Francisco

Last edited by dreamwinder (2011-02-08 13:54:00)