Hi there,
I'd like to use RMagick to watermark an image in the tmp directory
before Attachment_fu saves it to Amazon S3.
I took a look at the callbacks available in attachment_fu. There's an
'after_attachment_saved' method but this would be too late, and a
'before_thumbnail_saved' but this is no good because it's for
thumbnails.
I think I need 'before_attachment_saved' or the equivalent in the
attachment workflow.
I do have a watermark working for :file_system storage option using
the code below.
# -------------------------------------------- watermark on
file_system after initial save - but doesn't work for s3
def after_attachment_saved
unless self.thumbnail?
dst = Magick::Image.read("#{RAILS_ROOT}/public/#
{self.public_filename}").first
src = Magick::Image.read("#{RAILS_ROOT}/config/
logo.png").first
result = dst.composite(src, Magick::SouthEastGravity,
Magick::OverCompositeOp)
result.write("#{RAILS_ROOT}/public/#{self.public_filename}")
end
end
Now I'm looking for a way to hook into the attachment_fu process and
apply the watermark before the main image is saved to :s3
Or perhaps I'm approaching this in the wrong way? I'm reluctant to
start modifying the 'write_to_temp_file' method in the attachment_fu
plugin.
Any help or advice anyone has would be much appreciated.
Many thanks,
Will
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---