<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Automatically Creating a Thumbnail With PHP</title>
	<atom:link href="http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/</link>
	<description>presented by Site Potion</description>
	<lastBuildDate>Thu, 03 Jun 2010 12:34:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Clay</title>
		<link>http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/comment-page-1/#comment-60531</link>
		<dc:creator>Clay</dc:creator>
		<pubDate>Thu, 22 Jan 2009 14:41:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/#comment-60531</guid>
		<description>I&#039;ve adapted this code a bit over the last two years.  Here it is in function form:

function _resizeImage($imagesource,$imagedestination,$mimetype,$new_w  = 0,$new_h = 0) {
  if($new_w == 0 &amp;&amp; $new_h == 0) {
    return &#039;You must provide a new width or height value.&#039;;
  }
  if($mimetype == &#039;image/jpeg&#039;) { $src_img = imagecreatefromjpeg($imagesource); }
  if($mimetype == &#039;image/gif&#039;) { $src_img = imagecreatefromgif($imagesource); }
  if($mimetype == &#039;image/png&#039;) { $src_img = imagecreatefrompng($imagesource); }

  $origw=imagesx($src_img);
  $origh=imagesy($src_img);
  if($new_w &gt; 0 &amp;&amp; $new_h == 0) {
    $scale = $origw/$new_w;
    $new_h = round($origh/$scale,0);
  }
  if($new_h &gt; 0 &amp;&amp; $new_w == 0) {
    $scale = $origh/$new_h;
    $new_w = round($origw/$scale,0);
  }

  $dst_img = imagecreatetruecolor($new_w,$new_h);
  imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
  if($mimetype == &#039;image/jpeg&#039;) { return imagejpeg($dst_img, $imagedestination); }
  if($mimetype == &#039;image/gif&#039;) { return imagegif($dst_img, $imagedestination); }
  if($mimetype == &#039;image/png&#039;) { return imagepng($dst_img, $imagedestination); }
}</description>
		<content:encoded><![CDATA[<p>I&#8217;ve adapted this code a bit over the last two years.  Here it is in function form:</p>
<p>function _resizeImage($imagesource,$imagedestination,$mimetype,$new_w  = 0,$new_h = 0) {<br />
  if($new_w == 0 &#038;&#038; $new_h == 0) {<br />
    return &#8216;You must provide a new width or height value.&#8217;;<br />
  }<br />
  if($mimetype == &#8216;image/jpeg&#8217;) { $src_img = imagecreatefromjpeg($imagesource); }<br />
  if($mimetype == &#8216;image/gif&#8217;) { $src_img = imagecreatefromgif($imagesource); }<br />
  if($mimetype == &#8216;image/png&#8217;) { $src_img = imagecreatefrompng($imagesource); }</p>
<p>  $origw=imagesx($src_img);<br />
  $origh=imagesy($src_img);<br />
  if($new_w > 0 &#038;&#038; $new_h == 0) {<br />
    $scale = $origw/$new_w;<br />
    $new_h = round($origh/$scale,0);<br />
  }<br />
  if($new_h > 0 &#038;&#038; $new_w == 0) {<br />
    $scale = $origh/$new_h;<br />
    $new_w = round($origw/$scale,0);<br />
  }</p>
<p>  $dst_img = imagecreatetruecolor($new_w,$new_h);<br />
  imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));<br />
  if($mimetype == &#8216;image/jpeg&#8217;) { return imagejpeg($dst_img, $imagedestination); }<br />
  if($mimetype == &#8216;image/gif&#8217;) { return imagegif($dst_img, $imagedestination); }<br />
  if($mimetype == &#8216;image/png&#8217;) { return imagepng($dst_img, $imagedestination); }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clay</title>
		<link>http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/comment-page-1/#comment-36718</link>
		<dc:creator>Clay</dc:creator>
		<pubDate>Fri, 07 Sep 2007 11:05:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/#comment-36718</guid>
		<description>Shaaa: the most likely explanation is that you are using a version of PHP that does not include the GD library automatically bundled.  (I believe they started bundling it with the core PHP code in version 4.3.)  You can either upgrade your version of PHP or manually set up the GD library.  You can download the files and find instructions at:

http://www.libgd.org/Main_Page</description>
		<content:encoded><![CDATA[<p>Shaaa: the most likely explanation is that you are using a version of PHP that does not include the GD library automatically bundled.  (I believe they started bundling it with the core PHP code in version 4.3.)  You can either upgrade your version of PHP or manually set up the GD library.  You can download the files and find instructions at:</p>
<p><a href="http://www.libgd.org/Main_Page" rel="nofollow">http://www.libgd.org/Main_Page</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shaaa</title>
		<link>http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/comment-page-1/#comment-36717</link>
		<dc:creator>Shaaa</dc:creator>
		<pubDate>Fri, 07 Sep 2007 09:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.indywebshop.com/bestpractices/2006/12/13/automatically-creating-a-thumbnail-with-php/#comment-36717</guid>
		<description>This code is not working...

can any one help me?

it says...

&quot;Call to undefined function imagecreatefromjpeg()&quot;</description>
		<content:encoded><![CDATA[<p>This code is not working&#8230;</p>
<p>can any one help me?</p>
<p>it says&#8230;</p>
<p>&#8220;Call to undefined function imagecreatefromjpeg()&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
