
<?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>Achari.in &#187; thumbnail generation using uploadify.php</title>
	<atom:link href="http://www.achari.in/tag/thumbnail-generation-using-uploadify.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.achari.in</link>
	<description>achari.in is a programmer&#039;s blog maintained by Anoop S Achari. Tutorials focus on Google Map API Integration, Twitter OAuth, Facebook Integration, Jquery, JSE, SCJP Materials and other technical articles.</description>
	<lastBuildDate>Thu, 26 Jan 2012 08:58:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Thumbnail Creation using uploadify.php</title>
		<link>http://www.achari.in/thumbnail-creation-using-uploadify-php</link>
		<comments>http://www.achari.in/thumbnail-creation-using-uploadify-php#comments</comments>
		<pubDate>Mon, 14 Jun 2010 10:07:51 +0000</pubDate>
		<dc:creator>anoopsachari</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[flash thumbnail generator]]></category>
		<category><![CDATA[flash uploader]]></category>
		<category><![CDATA[gmail like file uploader code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[thumbnail creation in php]]></category>
		<category><![CDATA[thumbnail generation using uploadify.php]]></category>

		<guid isPermaLink="false">http://www.achari.in/?p=429</guid>
		<description><![CDATA[Hello friends i came across a good jquery flash file up-loader here . Do use it its simple and powerful . The next main thing was generation of thumbnail using the same flash uploader after some homework found a solution for it . Do some simple updations in your existing code . 1. Create a [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; padding-bottom:10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.achari.in%2Fthumbnail-creation-using-uploadify-php"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.achari.in%2Fthumbnail-creation-using-uploadify-php&amp;source=anoopsachari&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello friends i came across a good jquery flash file up-loader <a href="http://www.uploadify.com/">here</a> . Do use it its simple and powerful .</p>
<p>The next main thing was generation of thumbnail using the same flash uploader after some homework found a solution for it . Do some simple updations in your existing code .</p>
<p>1. Create a folder named &#8220;<strong>thumbnails</strong>&#8221; under the upload folder .</p>
<p>2. Replace the code in uploadify.php [you can find it under scripts folder] with the following code .</p>
<pre class="brush: php;">

if (!empty($_FILES))
{
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
echo &quot;1&quot;;
}
$imgsize = getimagesize($targetFile);
switch(strtolower(substr($targetFile, -3)))
{
case &quot;jpg&quot;:
$image = imagecreatefromjpeg($targetFile);
break;
case &quot;png&quot;:
$image = imagecreatefrompng($targetFile);
break;
case &quot;gif&quot;:
$image = imagecreatefromgif($targetFile);
break;
default:
exit;
break;
}

$width = 80; //New width of image
$height = $imgsize[1]/$imgsize[0]*$width; //This maintains proportions

$src_w = $imgsize[0];
$src_h = $imgsize[1];

$picture = imagecreatetruecolor($width, $height);
imagealphablending($picture, false);
imagesavealpha($picture, true);
$bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $width, $height, $src_w, $src_h);

if($bool)
{
switch(strtolower(substr($targetFile, -3)))
{
case &quot;jpg&quot;:
header(&quot;Content-Type: image/jpeg&quot;);
$bool2 = imagejpeg($picture,$targetPath.&quot;thumbnails/&quot;.$_FILES['Filedata']['name'],80);
break;
case &quot;png&quot;:
header(&quot;Content-Type: image/png&quot;);
imagepng($picture,$targetPath.&quot;thumbnails/&quot;.$_FILES['Filedata']['name']);
break;
case &quot;gif&quot;:
header(&quot;Content-Type: image/gif&quot;);
imagegif($picture,$targetPath.&quot;thumbnails/&quot;.$_FILES['Filedata']['name']);
break;
}
}

imagedestroy($picture);
imagedestroy($image);

echo '1';
</pre>
<p>You are done ! Hope it helped you .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.achari.in/thumbnail-creation-using-uploadify-php/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

