<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Glamour &#187; Tips &amp; Tricks</title>
	<atom:link href="http://wpglamour.com/category/tips-tricks-for-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpglamour.com</link>
	<description>free and premium wordpress themes</description>
	<lastBuildDate>Fri, 23 Jul 2010 19:10:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to watermark all your uploaded images</title>
		<link>http://wpglamour.com/how-to-watermark-all-your-uploaded-images/</link>
		<comments>http://wpglamour.com/how-to-watermark-all-your-uploaded-images/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 09:33:11 +0000</pubDate>
		<dc:creator>GlamourGaby</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://wpglamour.com/?p=13</guid>
		<description><![CDATA[How many of you wanted to place a watermark on all of your images? Let&#039;s say you are just starting your own blog and the first solution that comes to mind is to fire up Adobe Photoshop or any other image editing program and place a watermark on all your images. It is time consuming [...]<p><a href="http://wpglamour.com/how-to-watermark-all-your-uploaded-images/">How to watermark all your uploaded images</a></p>
]]></description>
			<content:encoded><![CDATA[<p>How many of you wanted to place a watermark on all of your images?<br />
Let&#039;s say you are just starting your own blog and the first solution that comes to mind is to fire up Adobe Photoshop or any other image editing program and place a watermark on all your images. It is time consuming but it will work.</p>
<p>But what if you have a blog for a really long time and you just decided you want to watermark all your images? You would have to copy all your images from your blog to your computer, open all of them up and add a watermark. Not good.</p>
<p>But what about the original images? What if you ever need them without the watermark?<br />
Here is my solution. I have been using this on a number of blogs and it does the job really well.</p>
<p><span id="more-13"></span><br />
What we are going to do is fake the display of an image. What we are displaying instead of the image is a php file that processes the image and ads a watermark to it. The url of the image stays the same, the watermark gets printed on the image and best of all the image on the server doesn&#039;t stays intact.</p>
<p>All you need is a bit of code in your .htaccess file, a php watermark processing file and a watermark image (png preferably).</p>
<h3>Step 1</h3>
<p>Add this code in your .htaccess file:</p>
<pre name="code"  class="php">
RewriteRule ^(.*)wp-content/uploads/(.*) $1watermark.php?src=wp-content/uploads/$2
</pre>
<h3>Step 2</h3>
<p>Create a new file in the root of your directory(where wp-admin, wp-content and wp-include is) and name that file watermark.php. After that copy and paste the code below in that file and save it(obviously).</p>
<pre name="code" class="php">
$src = $_GET['src'];

header('Content-type: image/jpeg');

//this will prevent the watermark from showing up in the thumbnail images
if (eregi("150x150", $src)) {
	$watermark = imagecreatefrompng('empty.png');
} else {
	$watermark = imagecreatefrompng('watermark.png');
}
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
$image = imagecreatetruecolor($watermark_width, $watermark_height);
if(eregi('.gif',$src)) {
$image = imagecreatefromgif($src);
}
elseif(eregi('.jpeg',$src)||eregi('.jpg',$src)) {
$image = imagecreatefromjpeg($src);
}
elseif(eregi('.png',$src)) {
$image = imagecreatefrompng($src);
}
else {
exit("Your image is not a gif, jpeg or png image. Sorry.");
}
$size = getimagesize($src);
$dest_x = $size[0] - $watermark_width - 0;
$dest_y = $size[1] - $watermark_height - 0;
imagecolortransparent($watermark,imagecolorat($watermark,0,0));
imagecopyresampled($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $watermark_width, $watermark_height);

imagejpeg($image, "", 95);
imagedestroy($image);
imagedestroy($watermark);
</pre>
<p>Use any image editor you like and create a png file that you will use as your watermark image. Save that image with the name &#034;watermark.png&#034; and put it in your root directory.<br />
Also create a png image which is 1x1pixels and it must be transparent. Name that file &#034;empty.png&#034; and save it also in your root directory.</p>
<p>That 1x1px image is meant to be displayed on the thumbnail images. The thumbnails are to small to put a watermark on them, it wouldn&#039;t look too good.</p>
<p>I also made an archive with everything you need:</p>
<a class="downloadlink" href="http://wpglamour.com/download/Watermark.zip" title="Version 1 downloaded 1623 times" >Watermark Script (3.49 KB)</a>
<p><a href="http://wpglamour.com/how-to-watermark-all-your-uploaded-images/">How to watermark all your uploaded images</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wpglamour.com/how-to-watermark-all-your-uploaded-images/feed/</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
	</channel>
</rss>
