<?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>Binary Tides &#187; mootools</title>
	<atom:link href="http://www.binarytides.com/blog/category/mootools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.binarytides.com/blog</link>
	<description></description>
	<lastBuildDate>Sat, 24 Jul 2010 05:31:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Javascript Image Cropper with Mootools and PHP</title>
		<link>http://www.binarytides.com/blog/javascript-image-cropper-with-mootools-and-php/</link>
		<comments>http://www.binarytides.com/blog/javascript-image-cropper-with-mootools-and-php/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 13:26:00 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=46</guid>
		<description><![CDATA[MooCrop is a library which can be used to create a cropping interface in your webpage. With this library after a crop region is selected a php script can be called to crop the image on serverside. The moocrop interface provides four values that is the width , height , left and top of the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nwhite.net/MooCrop/">MooCrop</a> is a library which can be used to create a cropping interface in your webpage. With this library after a crop region is selected a php script can be called to crop the image on serverside. The moocrop interface provides four values that is the width , height , left and top of the crop region ; these values can be used by a php script to crop an image.</p>
<p><span id="more-46"></span></p>
<p>So these values can be obtained in the script like this :<br />$x = $_GET['x'];<br />$y = $_GET['y'];<br />$h = $_GET['h'];<br />$w = $_GET['w'];</p>
<p>For e.g. if its a jpg image then</p>
<p>$src = imagecreatefromjpeg($path);<br />where $path has the path to the image.</p>
<p>Now create a new image with height and width<br />$dest = imagecreatetruecolor($w, $h);<br />imagecopy($dest, $src, 0, 0, $x, $y, $w, $h);</p>
<p>Now overwrite the existing file :<br />imagejpeg($dest , $path);</p>
<p>You may need to do a chmod over the new file.<br />chmod($path , 0755);</p>
<p>Free memory<br />imagedestroy($dest);<br />imagedestroy($src);</p>
<p>Now $path is the new image which is cropped as per the values of x , y , h , w</p>
<img src="http://www.binarytides.com/blog/?ak_action=api_record_view&id=46&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.binarytides.com/blog/javascript-image-cropper-with-mootools-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
