I''m working on a photo gallery and I''m using File_column to handle the uploads of the files and create my thumbnails, but does anyone here have any idea how to have a watermark (opaque text maybe) placed over one of the versions? Any ideas on how to go about this would be great. Even if it''s just straight RMagick code, that would be fine too. Thanks in advance for the help! Brian Hogan Web Development Learning & Technology Services Schofield 3-B University of Wisconsin-Eau Claire 715 836 3585 hoganbp@uwec.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060228/b1805d9b/attachment.html
I have a similar requirement; did you find any solution for this? thanks Hogan, Brian P. wrote:> I''m working on a photo gallery and I''m using File_column to handle the > uploads of the files and create my thumbnails, but does anyone here have > any idea how to have a watermark (opaque text maybe) placed over one of > the versions? Any ideas on how to go about this would be great. Even if > it''s just straight RMagick code, that would be fine too. > > Thanks in advance for the help! > > Brian Hogan > Web Development > Learning & Technology Services > Schofield 3-B > University of Wisconsin-Eau Claire > 715 836 3585 > hoganbp-VnAisaAFmHY@public.gmane.org-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Hogan, Brian P. wrote:> I''m working on a photo gallery and I''m using File_column to handle the > uploads of the files and create my thumbnails, but does anyone here have > any idea how to have a watermark (opaque text maybe) placed over one of > the versions? Any ideas on how to go about this would be great. Even if > it''s just straight RMagick code, that would be fine too. > > Thanks in advance for the help! >There are many ways to write text on an image with RMagick. The simplest way is to use the Draw#text method: http://www.simplesystems.org/RMagick/doc/draw.html#text. Also check out the example for the Image#watermark method: http://www.simplesystems.org/RMagick/doc/image3.html#watermark and the example for the Image#mask attribute: http://www.simplesystems.org/RMagick/doc/imageattrs.html#mask. These last two require that you have RMagick 1.14.0 or later. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Hogan, Brian P. wrote:> I''m working on a photo gallery and I''m using File_column to handle the > uploads of the files and create my thumbnails, but does anyone here have > any idea how to have a watermark (opaque text maybe) placed over one of > the versions? Any ideas on how to go about this would be great. Even if > it''s just straight RMagick code, that would be fine too. > > Thanks in advance for the help! > > Brian Hogan > Web Development > Learning & Technology Services > Schofield 3-B > University of Wisconsin-Eau Claire > 715 836 3585 > hoganbp-VnAisaAFmHY@public.gmane.orgI''ve just released an updated to the FlexImage that makes it super easy to do just that. Simply provide a PNG and give it some basic info on how to size and place it. Check it out. http://beautifulpixel.com/articles/2006/10/26/flex-image-now-has-special-effects -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
FlexImage seems great, but i would prefer to story my images on disk rather than in the DB.... thats not possible with FlexImage, is it? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Thorsten L wrote:> FlexImage seems great, but i would prefer to story my images on disk > rather than in the DB.... thats not possible with FlexImage, is it?Not currently, sorry :( At the very least you can take a look into the source and see the rmagick commands that do the overlay. Check out FlexImage::Model#overlay! for the implementation. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I totally forgot I posted this. I figured it out with RMagick a long time
ago... it''s pretty simple actually
This places "sample" diagonally across the middle of the image. You
needa
graphic called ''sample.png'' that contains some alpha
transparency but that''s
easy to create.
class Photo < ActiveRecord::Base
file_column :filename, :magick => {
:versions => { "thumb" => "50x50",
"large" => "320x240>" }
}
validates_presence_of :filename, :description
before_create :watermark_image
private
def watermark_image
require ''RMagick'' # probably don''t need this
line but it''s here
anyway
dst = Magick::Image.read(self.filename).first
src =
Magick::Image.read("#{RAILS_ROOT}/config/sample.png").first
result = dst.composite(src, Magick::CenterGravity,
Magick::OverCompositeOp)
result.write(self.filename)
end
end
On 10/26/06, Thorsten L <duplexxx-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:>
>
> FlexImage seems great, but i would prefer to story my images on disk
> rather than in the DB.... thats not possible with FlexImage, is it?
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---