<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Programming Ideas, Logics, Tips and Tricks &#187; gd</title>
	<atom:link href="http://www.sajithmr.me/tag/gd/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sajithmr.me</link>
	<description></description>
	<lastBuildDate>Sat, 07 Apr 2012 16:30:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Intelligent Watermark (php + gd)</title>
		<link>http://www.sajithmr.me/intelligent-watermark-php-gd</link>
		<comments>http://www.sajithmr.me/intelligent-watermark-php-gd#comments</comments>
		<pubDate>Sat, 09 Aug 2008 04:51:45 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[live]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/intelligent-watermark-php-gd/</guid>
		<description><![CDATA[Online Photoshop in PHP Part (5) &#62;&#62; (image after watermarked with gmail logo) Those who haven&#8217;t seen  the online photoshop tool created by me, just click here: http://www.sajithmr.com/photoshop Today we will implement the watermarking on images using php gd library. Intelligent watermarking means, apply a logo or a watermark image on another image by measuring [...]]]></description>
			<content:encoded><![CDATA[<p><font color="#339966"><strong>Online Photoshop in PHP Part (5)</strong></font> &gt;&gt;</p>
<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/08/watermark.jpg" /></p>
<p><em><font color="#999999">(image after watermarked with gmail logo) </font></em></p>
<p>Those who haven&#8217;t seen  the online photoshop tool created by me, just click here: <a href="http://www.sajithmr.com/photoshop/" title="Online Photoshop" target="_blank">http://www.sajithmr.com/photoshop</a></p>
<p>Today we will implement the watermarking on images using php gd library. Intelligent watermarking means, apply a logo or a watermark image on another image by measuring the color depth of the applied image. For this water marking, use png images as logo or watermark  for better results.</p>
<p>Live example for watermark implementation:<a href="http://sajithmr.com/photoshop-tuts/watermark/addwatermark.php" title="Watermark implementation " target="_blank"> http://sajithmr.com/photoshop-tuts/watermark/addwatermark.php </a></p>
<p>You can see different watermark location by changing the x1,y1 and x2,y2 parameters of the following url:</p>
<p><a href="http://sajithmr.com/photoshop-tuts/watermark/showresult.php?x1=405&amp;y1=285&amp;x2=520&amp;y2=392&amp;width=115&amp;height=107" target="_blank">http://sajithmr.com/photoshop-tuts/watermark/showresult.php?x1=405&amp;y1=285&amp;x2=520&amp;y2=392&amp;width=115&amp;height=107 </a></p>
<p>See the watermark php source code here: <a href="http://sajithmr.com/photoshop-tuts/watermark/watermark.class.txt" title="Source code for watermark" target="_blank">http://sajithmr.com/photoshop-tuts/watermark/watermark.class.txt </a></p>
<p>Download the full-source code of watermarking implementation using php+gd from here: <a href="http://sajithmr.com/photoshop-tuts/watermark.rar" title="Full Source Code" target="_blank">http://sajithmr.com/photoshop-tuts/watermark.rar </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/intelligent-watermark-php-gd/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<series:name><![CDATA[Online Photoshop]]></series:name>
	</item>
		<item>
		<title>Crop Image Like Orkut</title>
		<link>http://www.sajithmr.me/crop-image-like-orkut</link>
		<comments>http://www.sajithmr.me/crop-image-like-orkut#comments</comments>
		<pubDate>Thu, 05 Jun 2008 07:36:32 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[crop]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[orkut]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/crop-image-like-orkut/</guid>
		<description><![CDATA[Online Photoshop in PHP (Series Part 4) &#62;&#62; Today we will discuss about cropping of images using php and gd library. Look at the simple example here: http://www.sajithmr.com/photoshop-tuts/crop/simplecrop.php$x1 = $_GET['x1']; $y1 = $_GET['y1']; $x2 = $_GET['x2']; $y2 = $_GET['y2']; $image_object = imagecreatefromjpeg('hari.jpg'); $image_cropped = Crop($image_object,$x1, $y1, $x2,$y2); $temp_path = rand(1,99999).&#34;hari.jpg&#34;; imagejpeg( $image_cropped,$temp_path); header('Location: simplecrop.php?img='.$temp_path ); [...]]]></description>
			<content:encoded><![CDATA[<h3><font color="#008080">Online Photoshop in PHP (Series Part 4) &gt;&gt;</font></h3>
<p><img src="http://www.sajithmr.com/wp-content/uploads/2008/06/orkut.jpg" alt="Crop Image Like Orkut" /></p>
<p>Today we will discuss about cropping of images using php and gd library.</p>
<p>Look  at the simple example here:</p>
<p><a href="http://www.sajithmr.com/photoshop-tuts/crop/simplecrop.php" title="Orkut Like Crop" target="_blank">http://www.sajithmr.com/photoshop-tuts/crop/simplecrop.php</a></p><pre class="crayon-plain-tag"><code>$x1 = $_GET['x1'];
$y1 = $_GET['y1'];

$x2 = $_GET['x2'];
$y2 = $_GET['y2'];	

$image_object =   imagecreatefromjpeg('hari.jpg');
$image_cropped =  Crop($image_object,$x1, $y1, $x2,$y2);
$temp_path = rand(1,99999).&quot;hari.jpg&quot;;
imagejpeg( $image_cropped,$temp_path);

header('Location: simplecrop.php?img='.$temp_path );	  

?&amp;gt;</code></pre><p>Here the Crop function is doing the real work.  x1 and y1 are Top-Left Coordinates of new image and  x2, y2 are the  Bottom-Right .</p>
<p>Here is the function for Crop</p><pre class="crayon-plain-tag"><code>function Crop($image, $xpos1,$ypos1,$xpos2,$ypos2)
	{
		require_once('class.cropcanvas.php');
		$cc =&amp;amp; new CropCanvas();
		$cc-&amp;gt;loadImageFromObject($image);
		$cc-&amp;gt;cropToDimensions($xpos1, $ypos1, $xpos2,$ypos2 );
		return $cc-&amp;gt;getImageObject();

	}

?&amp;gt;</code></pre><p><p>
You can see the class.cropcanvas.php file from the attachment.</p>
<p>In the above example, we have to enter each coordinates manually. See the example below:</p>
<p><a href="http://www.sajithmr.com/photoshop-tuts/crop/realcrop.php" target="_blank">http://www.sajithmr.com/photoshop-tuts/crop/realcrop.php</a></p>
<p>Here  you can select the area by click and drag (like orkut)</p>
<p>This is implemented with the help or jslib javascript. The given attachment in the end of this post contains the all.</p>
<p><a href="http://www.sajithmr.com/photoshop-tuts/crop.zip">http://www.sajithmr.com/photoshop-tuts/crop.zip</a></p>
<p><a href="http://www.sajithmr.com/photoshop-tuts/crop.zip"><img src="http://www.sajithmr.com/wp-content/uploads/2008/05/winzip_180x180.thumbnail.gif" width="79" height="79" /></a></p>
<p>Keep reading for the further posts in this series.  Next post is on <strong>Intellegent watermarking</strong> on images.</p>
<p>Subscribe to my Feeds:<a href="http://www.sajithmr.com/feed/" target="_blank"> http://www.sajithmr.com/feed/</a></p>
<p><a href="http://www.sajithmr.com/feed/" target="_blank"><img src="http://www.sajithmr.com/downloads/rss2.png" width="80" height="80" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/crop-image-like-orkut/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
	
		<series:name><![CDATA[Online Photoshop]]></series:name>
	</item>
		<item>
		<title>Online Photoshop in PHP (Series Part 3)</title>
		<link>http://www.sajithmr.me/online-photoshop-in-php-series-part-3</link>
		<comments>http://www.sajithmr.me/online-photoshop-in-php-series-part-3#comments</comments>
		<pubDate>Mon, 26 May 2008 15:30:47 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[implementation]]></category>
		<category><![CDATA[resize]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/online-photoshop-in-php-series-part-3/</guid>
		<description><![CDATA[Resize a Photo &#62;&#62; Today we will implement hows to resize photo into a particular width and height (or keeping aspect ratio) See the live example from: http://www.sajithmr.com/photoshop-tuts/resize/resize.php You need to install php-gd library to do this. To functions, imagecreatetruecolor and imagecopyresampled will do the resizing. Those who have not seen the Online Photo Editing [...]]]></description>
			<content:encoded><![CDATA[<h2>Resize a Photo &gt;&gt;</h2>
<p>Today we will implement hows to resize photo into a particular width and height (or keeping aspect ratio)</p>
<p>See the live example from: <a href="http://www.sajithmr.com/photoshop-tuts/resize/resize.php" target="_blank">http://www.sajithmr.com/photoshop-tuts/resize/resize.php</a></p>
<p>You need to install php-gd library to do this. To functions, <strong>imagecreatetruecolor</strong> and <strong>imagecopyresampled </strong>will do the resizing.</p>
<p>Those who have not seen the Online Photo Editing tool yet, have a look at: <a href="http://www.sajithmr.com/photoshop/index.php" title="Online Photo Editing Tool" target="_blank">http://www.sajithmr.com/photoshop/index.php </a></p>
<p>Here is the function:</p><pre class="crayon-plain-tag"><code>function Resize($image,$new_width,$new_height=0)
{

 $old_width = imagesx($image);
 $old_height= imagesy($image);

 if($new_height==0) // if the height is not specified
                           //....calculate the relative height
 $new_height= $new_width * $old_height / $old_width ;

 $new_image= imagecreatetruecolor($new_width, $new_height);
 imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width,
 $new_height, $old_width, $old_height);
 return $new_image;

}</code></pre><p>
Here the $image is the object of the image which is created from the function<strong> imagecreatefromgif</strong>($path_to_photo), if the image is in GIF format.</p>
<p>Other functions are <strong>imagecreatefromjpeg</strong> and <strong>imagecreatefrompng</strong> for JPEG and PNG respectively .</p>
<p>Download Full source code for this example from: <a href="http://www.sajithmr.com/photoshop-tuts/resize.zip">http://www.sajithmr.com/photoshop-tuts/resize.zip</a></p>
<p>In the previous part we implemented browse photos area. <a href="http://www.sajithmr.com/online-photoshop-in-php-series-part-2/" target="_blank">http://www.sajithmr.com/online-photoshop-in-php-series-part-2/</a></p>
<p>In that for browsing picture files, we used full size image, instead of thumbnails. Here new example , in which browse photos is implemented with image thumbnails using resizing (150 px)</p>
<p>The difference is , instead of calling img tag&#8217;s src to the orginal image path,  called through resize.php?img=path_to_image ,  passed the image path as parameter to resize function.</p>
<p>See live example: <a href="http://www.sajithmr.com/photoshop-tuts/browse-resize/browse.php" target="_blank">http://www.sajithmr.com/photoshop-tuts/browse-resize/browse.php</a></p>
<p>Take the html and see the difference from old browse implementation: <a href="http://www.sajithmr.com/photoshop-tuts/browse.php" target="_blank">http://www.sajithmr.com/photoshop-tuts/browse.php </a></p>
<p>Which is fast ??</p>
<p>Download the full source code for browsing with image thumbnail  from: <a href="http://www.sajithmr.com/photoshop-tuts/browse-resize.zip" target="_blank">http://www.sajithmr.com/photoshop-tuts/browse-resize.zip</a></p>
<p>Keep reading for the coming series,  part 4 , <strong>Orkut Like Photo Cropping &gt;&gt;</strong></p>
<p>Subscribe to this website feed now:<br />
<a href="http://feeds.feedburner.com/sajithmr"><img src="http://www.sajithmr.com/downloads/rss2.png" height="100" width="100" /></a></p>
<p>Regards</p>
<p>Sajith M.R</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/online-photoshop-in-php-series-part-3/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<series:name><![CDATA[Online Photoshop]]></series:name>
	</item>
		<item>
		<title>Online Photoshop in PHP (Series Part 1)</title>
		<link>http://www.sajithmr.me/online-photoshop-in-php-series-part-1</link>
		<comments>http://www.sajithmr.me/online-photoshop-in-php-series-part-1#comments</comments>
		<pubDate>Tue, 20 May 2008 13:05:50 +0000</pubDate>
		<dc:creator>Mr Me</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[php source code]]></category>
		<category><![CDATA[clear all]]></category>
		<category><![CDATA[crop]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[round]]></category>
		<category><![CDATA[save]]></category>
		<category><![CDATA[undo]]></category>
		<category><![CDATA[watermark]]></category>

		<guid isPermaLink="false">http://www.sajithmr.com/online-photoshop-in-php-series-part-1/</guid>
		<description><![CDATA[Introduction &#62;&#62; As i announced in my birthday post: celebrating-1st-year-of-sajithmr.com , i am starting my post series How to make Photoshop Express in PHP Before we starting the step by step procedure, have a look at : http://www.sajithmr.me/photoshop/index.php This is a basic version of online photo editing tool. You can either upload a photo to [...]]]></description>
			<content:encoded><![CDATA[<h1><span style="color: #339966;">Introduction &gt;&gt;</span></h1>
<p><a title="Online Photo Editing Tool" href="http://www.sajithmr.com/photoshop/index.php" target="_blank"><img src="http://www.sajithmr.com/wp-content/uploads/2008/05/screenshot1.jpg" alt="Online Photoshop in PHP (Series Part 1)" width="346" height="328" /></a></p>
<p>As i announced in my birthday post: <a title="1st Happy Birthday" href="http://www.sajithmr.com/celebrating-1st-year-of-sajithmrcom/" target="_blank">celebrating-1st-year-of-sajithmr.com</a> , i am starting my post series  <span style="text-decoration: underline;">How to make Photoshop Express  in PHP</span></p>
<p>Before we starting the step by step procedure, have a look at : <a title="Online Photoshop" href="http://www.sajithmr.me/photoshop" target="_blank">http://www.sajithmr.me/photoshop/index.php</a></p>
<p><a style="margin: 10px; float: left" href="http://www.sajithmr.com/photoshop/index.php" target="_blank"><img src="http://www.sajithmr.com/wp-content/uploads/2008/05/logo2.jpg" alt="" /></a></p>
<p>This is a basic version of online photo editing tool.</p>
<p>You can either upload a photo to this tool or you can browse some images already supplied.</p>
<p>The basic features are:</p>
<ol>
<li>Crop</li>
<li>Resize</li>
<li>Water marking (Both logo and text)</li>
<li>Round corner</li>
<li>Rotate</li>
<li>Download and save</li>
</ol>
<p><span style="text-decoration: underline;"> Try yourself</span></p>
<p>Upload some picture (or browse any picture), Press crop button (top left), you can see orkut photo upload like crop there. You can select the area, or drag anywhere in the image. Press crop button in the workdesk. (Press F11 or fullscreen view for better performance )</p>
<p>Try all other features provided.</p>
<p>The whole site is divided into four parts.</p>
<ol>
<li>Tools</li>
<li>Work Desk</li>
<li>Browse Photos</li>
<li>Settings</li>
</ol>
<p><strong>Tools area</strong> contains options for <span style="text-decoration: underline;">crop,</span> <span style="text-decoration: underline;">resize</span>, <span style="text-decoration: underline;">watermark,</span> <span style="text-decoration: underline;">round</span>, <span style="text-decoration: underline;">undo</span> , <span style="text-decoration: underline;">save,</span> <span style="text-decoration: underline;">clear all</span>, <span style="text-decoration: underline;">download</span>.</p>
<p><a href="http://www.sajithmr.com/photoshop/index.php" target="_blank"><img src="http://www.sajithmr.com/wp-content/uploads/2008/05/tool.jpg" alt="" /></a></p>
<p>Here <strong>&#8216;clear all&#8217;</strong> reset all the operations and navigate the website into initial settings.</p>
<p>From the <strong>Settings Area</strong>, You can fix the angle of the image. You can rotate either clock-wise or anti-clock-wise depending on the angle provided (+ve or -ve)</p>
<p><a href="http://www.sajithmr.com/photoshop/index.php" target="_blank"><img src="http://www.sajithmr.com/wp-content/uploads/2008/05/setting.jpg" alt="" /></a></p>
<p>In  <strong>Text Water Mark Setting Area</strong>, you can enter a text, set font size and font color. It generates a pictures corresponding to your text. Click water mark button in tool area and fix the position , press <strong>Apply Watermark </strong></p>
<p>You can also upload your water mark logo.</p>
<p>Finally you can download the edited picture by clicking download button in the Tool area (top right) .</p>
<p>The interesting thing is the whole website / tool is created in a single day.</p>
<p>wanna learn how to implement this ??</p>
<p>Keep reading rest of the series.</p>
<p>In <span style="color: #99cc00;"><span style="text-decoration: underline;"><strong>Online Photoshop in PHP (Series Part 2)</strong> </span></span> &gt;&gt; <span style="color: #ff6600;">Implementation of the <strong>Browse Photos</strong> Area</span></p>
<p>Thanks and Regards<br />
Sajith M.R</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sajithmr.me/online-photoshop-in-php-series-part-1/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<series:name><![CDATA[Online Photoshop]]></series:name>
	</item>
	</channel>
</rss>

