<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Watermarking an image in Rails</title>
	<atom:link href="http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/</link>
	<description>Ruby, Ruby on Rails, Los Angeles, Technology, Geek, Science, Life</description>
	<pubDate>Tue, 06 Jan 2009 07:40:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: PS</title>
		<link>http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/#comment-22819</link>
		<dc:creator>PS</dc:creator>
		<pubDate>Wed, 30 Apr 2008 01:25:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/#comment-22819</guid>
		<description>(Please delete my previous post)

Put  after_save :watermark_image  at the top of your model file.

Example:

class Asset::image
after_save :watermark_image

:storage =&#62; :file_system
...blah blah blah, attachment_fu junk...

validates_as_attachment

def watermark_image
...watermark method...
end
end</description>
		<content:encoded><![CDATA[<p>(Please delete my previous post)</p>
<p>Put  after_save :watermark_image  at the top of your model file.</p>
<p>Example:</p>
<p>class Asset::image<br />
after_save :watermark_image</p>
<p>:storage =&gt; :file_system<br />
&#8230;blah blah blah, attachment_fu junk&#8230;</p>
<p>validates_as_attachment</p>
<p>def watermark_image<br />
&#8230;watermark method&#8230;<br />
end<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/#comment-11583</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Fri, 28 Sep 2007 12:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/#comment-11583</guid>
		<description>It's after_save in fact ...

Cheers,
boris</description>
		<content:encoded><![CDATA[<p>It&#8217;s after_save in fact &#8230;</p>
<p>Cheers,<br />
boris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: D</title>
		<link>http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/#comment-11459</link>
		<dc:creator>D</dc:creator>
		<pubDate>Tue, 25 Sep 2007 13:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.danielfischer.com/2007/04/16/watermarking-an-image-in-rails/#comment-11459</guid>
		<description>I'm new to rails and attachment_fu can you post your model file code for this.

My model currently looks like this
class Asset  :image,
                 :storage =&#62; :file_system,
                 :thumbnails =&#62; { :thumb_sm =&#62; [25,25],
                                  :thumb_lg =&#62; [50,50],
                                  :small    =&#62; "150x150&#62;",
                                  :medium   =&#62; "300x300&#62;",
                                  :large    =&#62; "450x450&#62;"
                                }

  validates_as_attachment

def watermark_image 
  dst = Magick::Image.read("#{RAILS_ROOT}/public/#{self.public_filename}").first 
  src = Magick::Image.read("#{RAILS_ROOT}/config/upshot.png").first 
  result = dst.composite(src, Magick::SouthEastGravity, Magick::OverCompositeOp) 
  result.write("#{RAILS_ROOT}/public/#{self.public_filename}") 
end

Where should i place the after_safe effent because i want all the generated images to have the watermark</description>
		<content:encoded><![CDATA[<p>I&#8217;m new to rails and attachment_fu can you post your model file code for this.</p>
<p>My model currently looks like this<br />
class Asset  :image,<br />
                 :storage =&gt; :file_system,<br />
                 :thumbnails =&gt; { :thumb_sm =&gt; [25,25],<br />
                                  :thumb_lg =&gt; [50,50],<br />
                                  :small    =&gt; &#8220;150&#215;150&gt;&#8221;,<br />
                                  :medium   =&gt; &#8220;300&#215;300&gt;&#8221;,<br />
                                  :large    =&gt; &#8220;450&#215;450&gt;&#8221;<br />
                                }</p>
<p>  validates_as_attachment</p>
<p>def watermark_image<br />
  dst = Magick::Image.read(&#8221;#{RAILS_ROOT}/public/#{self.public_filename}&#8221;).first<br />
  src = Magick::Image.read(&#8221;#{RAILS_ROOT}/config/upshot.png&#8221;).first<br />
  result = dst.composite(src, Magick::SouthEastGravity, Magick::OverCompositeOp)<br />
  result.write(&#8221;#{RAILS_ROOT}/public/#{self.public_filename}&#8221;)<br />
end</p>
<p>Where should i place the after_safe effent because i want all the generated images to have the watermark</p>
]]></content:encoded>
	</item>
</channel>
</rss>
