<?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; image</title>
	<atom:link href="http://www.sajithmr.me/tag/image/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>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>
	</channel>
</rss>

