<?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: Resizing images in PHP with GD and Imagick</title>
	<atom:link href="http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/</link>
	<description>Beautiful Web Applications</description>
	<lastBuildDate>Tue, 07 Sep 2010 07:27:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Leon</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-24671</link>
		<dc:creator>Leon</dc:creator>
		<pubDate>Mon, 16 Aug 2010 03:51:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-24671</guid>
		<description>It looks like the GD crop functionality distorts the image.</description>
		<content:encoded><![CDATA[<p>It looks like the GD crop functionality distorts the image.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: evil</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-24669</link>
		<dc:creator>evil</dc:creator>
		<pubDate>Fri, 30 Jul 2010 12:44:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-24669</guid>
		<description>&lt;a href=&quot;http://www.lebron-james-shop.com&quot; rel=&quot;nofollow&quot;&gt;www.lebron-james-shop.com&lt;/a&gt;&lt;br&gt;good shoes!</description>
		<content:encoded><![CDATA[<p><a href="http://www.lebron-james-shop.com" rel="nofollow">http://www.lebron-james-shop.com</a><br />good shoes!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Glad1ator</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-24667</link>
		<dc:creator>Glad1ator</dc:creator>
		<pubDate>Thu, 22 Jul 2010 18:51:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-24667</guid>
		<description>$img-&gt;cropThumbnailImage($w, $h);&lt;br&gt;great!</description>
		<content:encoded><![CDATA[<p>$img-&gt;cropThumbnailImage($w, $h);<br />great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xcv</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-24533</link>
		<dc:creator>xcv</dc:creator>
		<pubDate>Sat, 03 Apr 2010 05:50:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-24533</guid>
		<description>fghgf</description>
		<content:encoded><![CDATA[<p>fghgf</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: indian</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-24518</link>
		<dc:creator>indian</dc:creator>
		<pubDate>Sat, 27 Mar 2010 11:41:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-24518</guid>
		<description>You ashole fuck your mother</description>
		<content:encoded><![CDATA[<p>You ashole fuck your mother</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fucking indians</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-24362</link>
		<dc:creator>fucking indians</dc:creator>
		<pubDate>Tue, 23 Feb 2010 21:49:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-24362</guid>
		<description>Epic comment is epic.</description>
		<content:encoded><![CDATA[<p>Epic comment is epic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spacegram</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-24245</link>
		<dc:creator>spacegram</dc:creator>
		<pubDate>Mon, 16 Nov 2009 11:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-24245</guid>
		<description>Hello &lt;br&gt;My name&#039;s spacegram, I&#039;m web developper and also one of your favorite web site user.&lt;br&gt;I realy liked this script but I got some problem with one of my similar script and I would like to ask you help. The problem I got with my script is that, the script is not allow me to resize my image so that I can get the wide and High size, but only the wide size.&lt;br&gt;That is my script.&lt;br&gt;&lt;br&gt;&lt;?php&lt;br&gt;&lt;br&gt;// MAIN ///////////////////////////////////////////////////////////////////////////////&lt;br&gt;&lt;br&gt;	/*&lt;br&gt;		This file is used externally, we will need to&lt;br&gt;		manually include the configuration file for&lt;br&gt;		this one&lt;br&gt;	*/&lt;br&gt;	include(&quot;conf.inc.php&quot;);&lt;br&gt;	&lt;br&gt;	// NO PICTURE CHECK ////////////////////////////////////////////////////////////&lt;br&gt;	/*&lt;br&gt;		We will assume the user has no picture by&lt;br&gt;		default -- the next few checks will reverse&lt;br&gt;		that if necessary.&lt;br&gt;	*/&lt;br&gt;	$GLOBALS[&quot;USE_NOPICTURE&quot;] = true;&lt;br&gt;	&lt;br&gt;	/*&lt;br&gt;		The file to be loaded is passed in the URL,&lt;br&gt;		we will make sure a file name has been passed.&lt;br&gt;	*/&lt;br&gt;	if (isset($_GET[&quot;file&quot;])) {&lt;br&gt;	&lt;br&gt;		/*&lt;br&gt;			We will also prevent &quot;slashes&quot; in the filename&lt;br&gt;			as a protection (so they can&#039;t use the ../ call&lt;br&gt;			to force this to climb up in the directory tree&lt;br&gt;		*/&lt;br&gt;		if (!strpos($_GET[&quot;file&quot;], &quot;/&quot;)) {&lt;br&gt;			&lt;br&gt;			/*&lt;br&gt;				Check the file name extention gainst the&lt;br&gt;				allowed list. We won&#039;t work with unallowed&lt;br&gt;				stuff&lt;br&gt;			*/&lt;br&gt;			$fileNameChunks = explode(&quot;.&quot;, $_GET[&quot;file&quot;]);&lt;br&gt;			if (in_array($fileNameChunks[count($fileNameChunks)-1], explode(&quot;,&quot;, $CONF[&quot;PICTURES_ALLOWED_EXTENTIONS&quot;]))) {&lt;br&gt;			&lt;br&gt;				/*&lt;br&gt;					We will take a look out and see if the&lt;br&gt;					file exists&lt;br&gt;				*/&lt;br&gt;				if (is_file(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$_GET[&quot;file&quot;]}&quot;)) {&lt;br&gt;					&lt;br&gt;					/*&lt;br&gt;						Don&#039;t process pictures that could cause potential&lt;br&gt;						errors because of their size (max allocation.e)&lt;br&gt;					*/&lt;br&gt;					if (filesize(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$_GET[&quot;file&quot;]}&quot;) &lt; $CONF[&quot;IMAGE_MAX_FILE_SIZE&quot;]) {&lt;br&gt;					&lt;br&gt;						/*&lt;br&gt;							We&#039;re over all the checks, let&#039;s set the following&lt;br&gt;							variable so the processor don&#039;t take the &quot;nopicture&quot;&lt;br&gt;							file.&lt;br&gt;						*/&lt;br&gt;						$GLOBALS[&quot;USE_NOPICTURE&quot;] = false;&lt;br&gt;						&lt;br&gt;					}&lt;br&gt;				}&lt;br&gt;			}&lt;br&gt;		}&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	/*&lt;br&gt;		Set the $fileName variable for future use&lt;br&gt;	*/&lt;br&gt;	if ($GLOBALS[&quot;USE_NOPICTURE&quot;]) $fileName = $CONF[&quot;IMAGE_NOFILE_DEFAULT_FILE&quot;];&lt;br&gt;	else $fileName = $_GET[&quot;file&quot;];	&lt;br&gt;	&lt;br&gt;	// PICTURE WIDTH VARIABLE //////////////////////////////////////////////////////&lt;br&gt;	/*&lt;br&gt;		Now we will check if a picture size has&lt;br&gt;		been passed. If not, we will consider &lt;br&gt;		that we must process a thumbnail&lt;br&gt;	*/&lt;br&gt;	if (isset($_GET[&quot;width&quot;]) and is_numeric($_GET[&quot;width&quot;]) and $_GET[&quot;width&quot;] &gt; 0) {&lt;br&gt;		&lt;br&gt;		/*&lt;br&gt;			We won&#039;t process a wallpaper-sized picture, &lt;br&gt;			let&#039;s make sure we don&#039;t go over the max width &lt;br&gt;			setting&lt;br&gt;		*/&lt;br&gt;		if ($_GET[&quot;width&quot;] &lt; $CONF[&quot;IMAGE_MAX_WIDTH&quot;]) &lt;br&gt;			$newSize = $_GET[&quot;width&quot;];&lt;br&gt;&lt;br&gt;		else $newSize = $CONF[&quot;IMAGE_MAX_WIDTH&quot;];&lt;br&gt;	&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	/*&lt;br&gt;		Ok so no width? Let&#039;s make a thumbnail!&lt;br&gt;	*/&lt;br&gt;	else $newSize = $CONF[&quot;IMAGE_THUMBNAILS_SIZE&quot;];&lt;br&gt;	&lt;br&gt;	// LOAD PICTURE FILE CONTENT &amp; STREAM CACHE ////////////////////////////////////&lt;br&gt;	/*&lt;br&gt;		Let&#039;s first see if we&#039;ve got a cached version&lt;br&gt;		and if we&#039;re configured to use the cache.&lt;br&gt;	*/&lt;br&gt;	if ($CONF[&quot;IMAGE_CACHE_PROCESSED&quot;]) {&lt;br&gt;		&lt;br&gt;		/*&lt;br&gt;			We will now check if a cache of the called image exists. &lt;br&gt;		*/&lt;br&gt;		if (is_file(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/CACHE_{$fileName}_W&quot;.$newSize.&quot;.jpg&quot;)) {&lt;br&gt;			&lt;br&gt;			/*&lt;br&gt;				Configuration says: forward the user to the picture&lt;br&gt;				if we&#039;ve got a cache! Let&#039;s do it...&lt;br&gt;			*/&lt;br&gt;			if ($CONF[&quot;IMAGE_CACHE_DISPLAY:USE_FORWARD&quot;]) {&lt;br&gt;				header(&quot;Location: ../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/CACHE_{$fileName}_W&quot;.$newSize.&quot;.jpg&quot;);&lt;br&gt;				/*&lt;br&gt;					Don&#039;t go any further, we&#039;re done.&lt;br&gt;				*/&lt;br&gt;				die();&lt;br&gt;			}&lt;br&gt;			&lt;br&gt;			/*&lt;br&gt;				We&#039;ve been instructed to STREAM the file instead&lt;br&gt;				of forwarding the user to it... how about doing it?&lt;br&gt;			*/&lt;br&gt;			else {&lt;br&gt;				header($CONF[&quot;IMAGE_HEADER_STRING&quot;]);&lt;br&gt;				echo file_get_contents(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/CACHE_{$fileName}_W&quot;.$newSize.&quot;.jpg&quot;);&lt;br&gt;				/*&lt;br&gt;					Don&#039;t go any further, we&#039;re done.&lt;br&gt;				*/&lt;br&gt;				die();&lt;br&gt;			}&lt;br&gt;		}&lt;br&gt;		&lt;br&gt;		/*&lt;br&gt;			There was no cache file, we will have to process&lt;br&gt;			the original&lt;br&gt;		*/&lt;br&gt;		else $fileBuffer = file_get_contents(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);&lt;br&gt;&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	/*&lt;br&gt;		We&#039;ve been instructed not to use cache ... We will buffer &lt;br&gt;		the original image&lt;br&gt;	*/&lt;br&gt;	$fileBuffer = file_get_contents(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);&lt;br&gt;&lt;br&gt;	/*&lt;br&gt;		If the processor is disabled, we will just stream what&lt;br&gt;		we buffered...&lt;br&gt;	*/&lt;br&gt;	if (!$CONF[&quot;IMAGE_ENABLE_PROCESSOR:GD&quot;]) {&lt;br&gt;		header($CONF[&quot;IMAGE_HEADER_STRING&quot;]);&lt;br&gt;		echo $fileBuffer;&lt;br&gt;		/*&lt;br&gt;			Don&#039;t go any further, we&#039;re done.&lt;br&gt;		*/&lt;br&gt;		die();&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	// PROCESSOR ///////////////////////////////////////////////////////////////////	&lt;br&gt;	/* &lt;br&gt;		Load the original file into an image handle &lt;br&gt;	*/&lt;br&gt;	switch(substr($fileName, strrpos($fileName, &quot;.&quot;)+1, strlen($fileName))) {&lt;br&gt;		/*&lt;br&gt;			Jpeg Image&lt;br&gt;		*/&lt;br&gt;		case(&quot;jpg&quot;): case(&quot;jpeg&quot;):	&lt;br&gt;			$handle = imagecreatefromjpeg(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);	&lt;br&gt;		break;&lt;br&gt;		&lt;br&gt;		/*&lt;br&gt;			GIF image, note that we got two methods for loading&lt;br&gt;			it here, one using the GD1 engine, one with GD2.&lt;br&gt;		*/&lt;br&gt;		case(&quot;gif&quot;):&lt;br&gt;			$tempHandle = imagecreatefromgif(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);&lt;br&gt;&lt;br&gt;			if ($CONF[&quot;IMAGE_PROCESSOR:GD2&quot;]) $handle = imagecreatetruecolor(imagesx($tempHandle), imagesy($tempHandle)); &lt;br&gt;			else $handle = imagecreate($newSize, $processHeight);&lt;br&gt;			&lt;br&gt;			imagecopy($handle, $tempHandle, 0, 0, 0, 0, imagesx($tempHandle), imagesy($tempHandle));&lt;br&gt;		break;&lt;br&gt;		&lt;br&gt;		/*&lt;br&gt;			Png image&lt;br&gt;		*/&lt;br&gt;		case(&quot;png&quot;):&lt;br&gt;			$handle = imagecreatefrompng(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);&lt;br&gt;		break;&lt;br&gt;	}&lt;br&gt;&lt;br&gt;	/* Process to crop, fill or resize */&lt;br&gt;	switch($CONF[&quot;IMAGE_PROCESS_MODE&quot;]) {&lt;br&gt;		&lt;br&gt;		case(&quot;resize&quot;):&lt;br&gt;			/*&lt;br&gt;				In resize mode, we will only find the source picture biggest size axis (W/H) and&lt;br&gt;				resize that max value to the required processed size, the other axix is resized&lt;br&gt;				acordingly&lt;br&gt;			*/&lt;br&gt;			list($sourceWidth, $sourceHeight) = getimagesize(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);&lt;br&gt;			&lt;br&gt;			if ($sourceWidth &gt;= $sourceHeight) &lt;br&gt;				$ratio = $newSize / $sourceWidth;&lt;br&gt;			else &lt;br&gt;				$ratio = $newSize / $sourceHeight;&lt;br&gt;			&lt;br&gt;			$thumb = imagecreatetruecolor(round($sourceWidth * $ratio), round($sourceHeight * $ratio));&lt;br&gt;			&lt;br&gt;			imagecopyresampled(&lt;br&gt;				$thumb, &lt;br&gt;				$handle, &lt;br&gt;				0,&lt;br&gt;				0, &lt;br&gt;				0, &lt;br&gt;				0, &lt;br&gt;				round($sourceWidth * $ratio), &lt;br&gt;				round($sourceHeight * $ratio), &lt;br&gt;				$sourceWidth, &lt;br&gt;				$sourceHeight&lt;br&gt;			);&lt;br&gt;			&lt;br&gt;		break;&lt;br&gt;		&lt;br&gt;		case(&quot;crop&quot;): default:&lt;br&gt;			/*&lt;br&gt;				The crop mode picks the lowest source axis as its reference,&lt;br&gt;				the second axis is centered and cropped at constrained proportions&lt;br&gt;				values&lt;br&gt;			*/&lt;br&gt;			$thumb = imagecreatetruecolor(&lt;br&gt;				$newSize, &lt;br&gt;				$newHeight = round($newSize * $CONF[&quot;IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO&quot;])&lt;br&gt;			);&lt;br&gt;&lt;br&gt;			list($sourceWidth, $sourceHeight) = getimagesize(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);&lt;br&gt;			&lt;br&gt;			if ($sourceWidth &gt;= $sourceHeight) {&lt;br&gt;&lt;br&gt;				$intraSourceWidth = round($sourceHeight / $CONF[&quot;IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO&quot;]);&lt;br&gt;&lt;br&gt;				imagecopyresampled(&lt;br&gt;					$thumb, &lt;br&gt;					$handle, &lt;br&gt;					0, &lt;br&gt;					0, &lt;br&gt;					($sourceWidth / 2) - ($intraSourceWidth / 2),&lt;br&gt;					0,&lt;br&gt;					$newSize, &lt;br&gt;					$newHeight,&lt;br&gt;					$intraSourceWidth,&lt;br&gt;					$sourceHeight&lt;br&gt;				);&lt;br&gt;&lt;br&gt;			}&lt;br&gt;			&lt;br&gt;			else {&lt;br&gt;				&lt;br&gt;				$intraSourceHeight = round($sourceWidth * $CONF[&quot;IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO&quot;]);&lt;br&gt;&lt;br&gt;				imagecopyresampled(&lt;br&gt;					$thumb, &lt;br&gt;					$handle, &lt;br&gt;					0, &lt;br&gt;					0, &lt;br&gt;					0,&lt;br&gt;					($sourceHeight / 2) - ($intraSourceHeight / 2),&lt;br&gt;					$newSize, &lt;br&gt;					$newHeight,&lt;br&gt;					$sourceWidth,&lt;br&gt;					$intraSourceHeight&lt;br&gt;				);&lt;br&gt;			}&lt;br&gt;		break;&lt;br&gt;		&lt;br&gt;		case(&quot;fill&quot;):&lt;br&gt;			/*&lt;br&gt;				Fill mode resizes the original picture according to its&lt;br&gt;				highest axis to fit the thumbnail size. The lower axis&lt;br&gt;				is then used to center the result into the thumbnail&lt;br&gt;			*/&lt;br&gt;			$thumb = imagecreatetruecolor(&lt;br&gt;				$newSize, &lt;br&gt;				$newHeight = round($newSize * $CONF[&quot;IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO&quot;])&lt;br&gt;			);&lt;br&gt;&lt;br&gt;			list($sourceWidth, $sourceHeight) = getimagesize(&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/{$fileName}&quot;);&lt;br&gt;			&lt;br&gt;			if ($sourceWidth &gt;= $sourceHeight) {&lt;br&gt;				$ratio = $newSize / $sourceWidth;&lt;br&gt;				&lt;br&gt;				$intraSourceWidth = $newSize;&lt;br&gt;				$intraSourceHeight = $sourceHeight * $ratio;&lt;br&gt;				&lt;br&gt;				imagecopyresampled(&lt;br&gt;					$thumb,&lt;br&gt;					$handle,&lt;br&gt;					0,&lt;br&gt;					($newHeight / 2) - ($intraSourceHeight / 2),&lt;br&gt;					0,&lt;br&gt;					0,&lt;br&gt;					$newSize,&lt;br&gt;					ceil($intraSourceHeight),&lt;br&gt;					$sourceWidth,&lt;br&gt;					$sourceHeight&lt;br&gt;				);&lt;br&gt;			}&lt;br&gt;			&lt;br&gt;			else {&lt;br&gt;				$ratio = $newHeight / $sourceHeight;&lt;br&gt;				&lt;br&gt;				$intraSourceHeight = $newHeight;&lt;br&gt;				$intraSourceWidth = $sourceWidth * $ratio;&lt;br&gt;				&lt;br&gt;				imagecopyresampled(&lt;br&gt;					$thumb,&lt;br&gt;					$handle,&lt;br&gt;					($newSize / 2) - ($intraSourceWidth / 2),&lt;br&gt;					0,&lt;br&gt;					0,&lt;br&gt;					0,&lt;br&gt;					ceil($intraSourceWidth),&lt;br&gt;					$newHeight,&lt;br&gt;					$sourceWidth,&lt;br&gt;					$sourceHeight&lt;br&gt;				);&lt;br&gt;			}&lt;br&gt;&lt;br&gt;		break;&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	// IMAGE STAMP /////////////////////////////////////////////////////////////////&lt;br&gt;	if (($CONF[&quot;IMAGE_USE_STAMP_TEXT&quot;]) &amp;&amp; ($CONF[&quot;IMAGE_STAMP_TEXT&quot;] != &quot;&quot;)) {&lt;br&gt;		&lt;br&gt;		/*&lt;br&gt;			Lets just make sure this thumbnail is big enough to welcome&lt;br&gt;			the stamp text.&lt;br&gt;		*/&lt;br&gt;		if ($newSize &gt;= $CONF[&quot;IMAGE_STAMP_MINWIDTH&quot;]) {&lt;br&gt;		&lt;br&gt;			/*&lt;br&gt;				Now let&#039;s see where to place that stamp, The following switches&lt;br&gt;				will give a startup position for the stamp X/Y coords&lt;br&gt;			*/&lt;br&gt;			switch($CONF[&quot;IMAGE_STAMP_TEXT_LOCATION_Y&quot;]) {&lt;br&gt;				case(&quot;top&quot;): &lt;br&gt;					$stampLocationY = 0; &lt;br&gt;				break;&lt;br&gt;				&lt;br&gt;				case(&quot;middle&quot;): &lt;br&gt;					$stampLocationY = ($processHeight / 2) - ($CONF[&quot;IMAGE_STAMP_TEXT_SIZE&quot;]/2);&lt;br&gt;				break;&lt;br&gt;				&lt;br&gt;				case(&quot;bottom&quot;):	&lt;br&gt;					$stampLocationY = $processHeight - $CONF[&quot;IMAGE_STAMP_TEXT_SIZE&quot;];&lt;br&gt;				break;&lt;br&gt;			}&lt;br&gt;			&lt;br&gt;			switch($CONF[&quot;IMAGE_STAMP_TEXT_LOCATION_X&quot;]) {&lt;br&gt;				case(&quot;left&quot;): &lt;br&gt;					$stampLocationX = 0; &lt;br&gt;				break;&lt;br&gt;				&lt;br&gt;				case(&quot;middle&quot;):	&lt;br&gt;					$stampLocationX = ($newSize / 2) - ((strlen($CONF[&quot;IMAGE_STAMP_TEXT&quot;]) * $CONF[&quot;IMAGE_STAMP_TEXT_SIZE&quot;])/2);&lt;br&gt;				break;&lt;br&gt;				&lt;br&gt;				case(&quot;right&quot;):&lt;br&gt;					$stampLocationX = $newSize - (strlen($CONF[&quot;IMAGE_STAMP_TEXT&quot;]) * $CONF[&quot;IMAGE_STAMP_TEXT_SIZE&quot;]);&lt;br&gt;				break;&lt;br&gt;			}&lt;br&gt;			&lt;br&gt;			/*&lt;br&gt;				Now we add the padding values!&lt;br&gt;			*/&lt;br&gt;			$stampLocationX = $stampLocationX + $CONF[&quot;IMAGE_STAMP_TEXT_PADDING_X&quot;];&lt;br&gt;			$stampLocationY = $stampLocationY + $CONF[&quot;IMAGE_STAMP_TEXT_PADDING_Y&quot;];&lt;br&gt;			&lt;br&gt;			/*&lt;br&gt;				Are we supposed to add a drop shadow hilight on that?&lt;br&gt;			*/&lt;br&gt;			if ($CONF[&quot;IMAGE_STAMP_TEXT_DROPHILIGHT&quot;]) {&lt;br&gt;				/*&lt;br&gt;					Yep! First thing first; find the color code&lt;br&gt;					and attribute it to the handler.&lt;br&gt;				*/&lt;br&gt;				$color = explode(&quot;,&quot;, $CONF[&quot;IMAGE_STAMP_TEXT_DROPHILIGHT_COLOR&quot;]);&lt;br&gt;				$dropColor = imagecolorallocate($thumb, $color[0], $color[1], $color[2]);&lt;br&gt;				&lt;br&gt;				/*&lt;br&gt;					.. and add the string to the image (as this&lt;br&gt;					is a hilight and that we want it to be under the&lt;br&gt;					other text, we will set it first. How Logic!&lt;br&gt;				*/&lt;br&gt;				imagestring(&lt;br&gt;					$thumb, &lt;br&gt;					$CONF[&quot;IMAGE_STAMP_TEXT_SIZE&quot;], &lt;br&gt;					$stampLocationX + $CONF[&quot;IMAGE_STAMP_TEXT_DROPHILIGHT_DEPHASE&quot;], &lt;br&gt;					$stampLocationY + $CONF[&quot;IMAGE_STAMP_TEXT_DROPHILIGHT_DEPHASE&quot;], &lt;br&gt;					$CONF[&quot;IMAGE_STAMP_TEXT&quot;], &lt;br&gt;					$dropColor);&lt;br&gt;			}		&lt;br&gt;		&lt;br&gt;			/*&lt;br&gt;				Now we will add the top layer stamp. Let&#039;s find&lt;br&gt;				that color code and attribute it to the handler.&lt;br&gt;			*/&lt;br&gt;			$color = explode(&quot;,&quot;, $CONF[&quot;IMAGE_STAMP_TEXT_COLOR&quot;]);&lt;br&gt;			$stampColor = imagecolorallocate($thumb, $color[0], $color[1], $color[2]);&lt;br&gt;			&lt;br&gt;			/*&lt;br&gt;				... and text that!&lt;br&gt;			*/&lt;br&gt;			imagestring(&lt;br&gt;				$thumb, &lt;br&gt;				$CONF[&quot;IMAGE_STAMP_TEXT_SIZE&quot;], &lt;br&gt;				$stampLocationX, &lt;br&gt;				$stampLocationY, &lt;br&gt;				$CONF[&quot;IMAGE_STAMP_TEXT&quot;], &lt;br&gt;				$stampColor&lt;br&gt;			);&lt;br&gt;		}&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	// IMAGE WATERMARK /////////////////////////////////////////////////////////////&lt;br&gt;	if ($CONF[&quot;IMAGE_USE_WATERMARK&quot;] and imagesx($thumb) &gt;= $CONF[&quot;IMAGE_WATERMARK_MINWIDTH&quot;]) {&lt;br&gt;		&lt;br&gt;		/* Load watermark */&lt;br&gt;		list($srcmarkwidth, $srcmarkheight) = getimagesize(&quot;cache/pictures/&quot;.$CONF[&quot;IMAGE_WATERMARK_FILE&quot;]);&lt;br&gt;		$tempwmhandler = imagecreatefrompng(&quot;cache/pictures/&quot;.$CONF[&quot;IMAGE_WATERMARK_FILE&quot;]);&lt;br&gt;&lt;br&gt;		if ($srcmarkwidth &gt;= $srcmarkheight) {&lt;br&gt;			$wmwidth = (imagesx($thumb) * $CONF[&quot;IMAGE_WATERMARK_RESIZE_FACTOR&quot;]) / 100;&lt;br&gt;			$wmheight = round($srcmarkheight * ($wmwidth / $srcmarkwidth));&lt;br&gt;		}&lt;br&gt;			&lt;br&gt;		else {&lt;br&gt;			$wmheight = (imagesy($thumb) * $CONF[&quot;IMAGE_WATERMARK_RESIZE_FACTOR&quot;]) / 100;&lt;br&gt;			$wmwidth = round($markheight * ($wmheight / $srcmarkheight));&lt;br&gt;		}&lt;br&gt;		&lt;br&gt;		$watermark = imagecreatetruecolor($wmwidth, $wmheight);&lt;br&gt;		imagecopyresampled($watermark, $tempwmhandler, 0, 0, 0, 0, $wmwidth, $wmheight, $srcmarkwidth, $srcmarkheight);&lt;br&gt;&lt;br&gt;		imagecolortransparent($watermark, imagecolorallocate($watermark, 0, 0, 0));&lt;br&gt;		imagealphablending($watermark, true);&lt;br&gt;&lt;br&gt;		/* Put watermark over the picture */&lt;br&gt;		imagecopymerge(&lt;br&gt;			$thumb,&lt;br&gt;			$watermark, &lt;br&gt;			imagesx($thumb) - $wmwidth - $CONF[&quot;IMAGE_WATERMARK_PADDING&quot;], &lt;br&gt;			imagesy($thumb) - $wmheight - $CONF[&quot;IMAGE_WATERMARK_PADDING&quot;],&lt;br&gt;			0, &lt;br&gt;			0, &lt;br&gt;			$srcmarkwidth, &lt;br&gt;			$srcmarkheight, &lt;br&gt;			$CONF[&quot;IMAGE_WATERMARK_BLEND_VISIBILITY&quot;]&lt;br&gt;		);&lt;br&gt;&lt;br&gt;		imagedestroy($watermark);&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	// SAVE CACHE //////////////////////////////////////////////////////////////////&lt;br&gt;	/*&lt;br&gt;		Ok now we want to save a cached version of what&lt;br&gt;		we processed... well - Do we?&lt;br&gt;	*/	&lt;br&gt;	if ($CONF[&quot;IMAGE_CACHE_PROCESSED&quot;]) {&lt;br&gt;		/* &lt;br&gt;			Simple as one, two, sixteen. We save the cached&lt;br&gt;			result in a jpeg file!&lt;br&gt;		*/&lt;br&gt;		imagejpeg(&lt;br&gt;			$thumb, &lt;br&gt;			&quot;../&quot;.$CONF[&quot;IMAGE_DEFAULT_DIRECTORY&quot;].&quot;/CACHE_{$fileName}_W&quot;.$newSize.&quot;.jpg&quot;, &lt;br&gt;			$CONF[&quot;IMAGE_QUALITY&quot;]&lt;br&gt;		);&lt;br&gt;	}&lt;br&gt;	&lt;br&gt;	// STREAM BUFFER ///////////////////////////////////////////////////////////////&lt;br&gt;	/*&lt;br&gt;		Now we will stream the image to the browser.&lt;br&gt;	*/&lt;br&gt;	(!$CONF[&quot;IMAGE_PROCESSOR_DEBUG_MODE&quot;]?header($CONF[&quot;IMAGE_HEADER_STRING&quot;]):NULL);&lt;br&gt;	imagejpeg($thumb, false, $CONF[&quot;IMAGE_QUALITY&quot;]);&lt;br&gt;	&lt;br&gt;	/*&lt;br&gt;		And clean the mess ;)&lt;br&gt;	*/&lt;br&gt;	imagedestroy($thumb); &lt;br&gt;	imagedestroy($handle);&lt;br&gt;	&lt;br&gt;?&gt;&lt;br&gt;&lt;br&gt;And that is the way I get the picture on my web page &lt;br&gt;&quot;system/image_resize_heigth.php?file={me.mainpicture}&amp;width=260&quot;&lt;br&gt;Please I need your help.&lt;br&gt;&lt;br&gt;Best regard</description>
		<content:encoded><![CDATA[<p>Hello <br />My name&#39;s spacegram, I&#39;m web developper and also one of your favorite web site user.<br />I realy liked this script but I got some problem with one of my similar script and I would like to ask you help. The problem I got with my script is that, the script is not allow me to resize my image so that I can get the wide and High size, but only the wide size.<br />That is my script.</p>
<p>&lt;?php</p>
<p>// MAIN ///////////////////////////////////////////////////////////////////////////////</p>
<p>	/*<br />		This file is used externally, we will need to<br />		manually include the configuration file for<br />		this one<br />	*/<br />	include(&#8220;conf.inc.php&#8221;);</p>
<p>	// NO PICTURE CHECK ////////////////////////////////////////////////////////////<br />	/*<br />		We will assume the user has no picture by<br />		default &#8212; the next few checks will reverse<br />		that if necessary.<br />	*/<br />	$GLOBALS["USE_NOPICTURE"] = true;</p>
<p>	/*<br />		The file to be loaded is passed in the URL,<br />		we will make sure a file name has been passed.<br />	*/<br />	if (isset($_GET["file"])) {</p>
<p>		/*<br />			We will also prevent &#8220;slashes&#8221; in the filename<br />			as a protection (so they can&#39;t use the ../ call<br />			to force this to climb up in the directory tree<br />		*/<br />		if (!strpos($_GET["file"], &#8220;/&#8221;)) {</p>
<p>			/*<br />				Check the file name extention gainst the<br />				allowed list. We won&#39;t work with unallowed<br />				stuff<br />			*/<br />			$fileNameChunks = explode(&#8220;.&#8221;, $_GET["file"]);<br />			if (in_array($fileNameChunks[count($fileNameChunks)-1], explode(&#8220;,&#8221;, $CONF["PICTURES_ALLOWED_EXTENTIONS"]))) {</p>
<p>				/*<br />					We will take a look out and see if the<br />					file exists<br />				*/<br />				if (is_file(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$_GET["file"]}&#8221;)) {</p>
<p>					/*<br />						Don&#39;t process pictures that could cause potential<br />						errors because of their size (max allocation.e)<br />					*/<br />					if (filesize(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$_GET["file"]}&#8221;) &lt; $CONF["IMAGE_MAX_FILE_SIZE"]) {</p>
<p>						/*<br />							We&#39;re over all the checks, let&#39;s set the following<br />							variable so the processor don&#39;t take the &#8220;nopicture&#8221;<br />							file.<br />						*/<br />						$GLOBALS["USE_NOPICTURE"] = false;</p>
<p>					}<br />				}<br />			}<br />		}<br />	}</p>
<p>	/*<br />		Set the $fileName variable for future use<br />	*/<br />	if ($GLOBALS["USE_NOPICTURE"]) $fileName = $CONF["IMAGE_NOFILE_DEFAULT_FILE"];<br />	else $fileName = $_GET["file"];	</p>
<p>	// PICTURE WIDTH VARIABLE //////////////////////////////////////////////////////<br />	/*<br />		Now we will check if a picture size has<br />		been passed. If not, we will consider <br />		that we must process a thumbnail<br />	*/<br />	if (isset($_GET["width"]) and is_numeric($_GET["width"]) and $_GET["width"] &gt; 0) {</p>
<p>		/*<br />			We won&#39;t process a wallpaper-sized picture, <br />			let&#39;s make sure we don&#39;t go over the max width <br />			setting<br />		*/<br />		if ($_GET["width"] &lt; $CONF["IMAGE_MAX_WIDTH"]) <br />			$newSize = $_GET["width"];</p>
<p>		else $newSize = $CONF["IMAGE_MAX_WIDTH"];</p>
<p>	}</p>
<p>	/*<br />		Ok so no width? Let&#39;s make a thumbnail!<br />	*/<br />	else $newSize = $CONF["IMAGE_THUMBNAILS_SIZE"];</p>
<p>	// LOAD PICTURE FILE CONTENT &#038; STREAM CACHE ////////////////////////////////////<br />	/*<br />		Let&#39;s first see if we&#39;ve got a cached version<br />		and if we&#39;re configured to use the cache.<br />	*/<br />	if ($CONF["IMAGE_CACHE_PROCESSED"]) {</p>
<p>		/*<br />			We will now check if a cache of the called image exists. <br />		*/<br />		if (is_file(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/CACHE_{$fileName}_W&#8221;.$newSize.&#8221;.jpg&#8221;)) {</p>
<p>			/*<br />				Configuration says: forward the user to the picture<br />				if we&#39;ve got a cache! Let&#39;s do it&#8230;<br />			*/<br />			if ($CONF["IMAGE_CACHE_DISPLAY:USE_FORWARD"]) {<br />				header(&#8220;Location: ../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/CACHE_{$fileName}_W&#8221;.$newSize.&#8221;.jpg&#8221;);<br />				/*<br />					Don&#39;t go any further, we&#39;re done.<br />				*/<br />				die();<br />			}</p>
<p>			/*<br />				We&#39;ve been instructed to STREAM the file instead<br />				of forwarding the user to it&#8230; how about doing it?<br />			*/<br />			else {<br />				header($CONF["IMAGE_HEADER_STRING"]);<br />				echo file_get_contents(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/CACHE_{$fileName}_W&#8221;.$newSize.&#8221;.jpg&#8221;);<br />				/*<br />					Don&#39;t go any further, we&#39;re done.<br />				*/<br />				die();<br />			}<br />		}</p>
<p>		/*<br />			There was no cache file, we will have to process<br />			the original<br />		*/<br />		else $fileBuffer = file_get_contents(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);</p>
<p>	}</p>
<p>	/*<br />		We&#39;ve been instructed not to use cache &#8230; We will buffer <br />		the original image<br />	*/<br />	$fileBuffer = file_get_contents(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);</p>
<p>	/*<br />		If the processor is disabled, we will just stream what<br />		we buffered&#8230;<br />	*/<br />	if (!$CONF["IMAGE_ENABLE_PROCESSOR:GD"]) {<br />		header($CONF["IMAGE_HEADER_STRING"]);<br />		echo $fileBuffer;<br />		/*<br />			Don&#39;t go any further, we&#39;re done.<br />		*/<br />		die();<br />	}</p>
<p>	// PROCESSOR ///////////////////////////////////////////////////////////////////	<br />	/* <br />		Load the original file into an image handle <br />	*/<br />	switch(substr($fileName, strrpos($fileName, &#8220;.&#8221;)+1, strlen($fileName))) {<br />		/*<br />			Jpeg Image<br />		*/<br />		case(&#8220;jpg&#8221;): case(&#8220;jpeg&#8221;):	<br />			$handle = imagecreatefromjpeg(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);	<br />		break;</p>
<p>		/*<br />			GIF image, note that we got two methods for loading<br />			it here, one using the GD1 engine, one with GD2.<br />		*/<br />		case(&#8220;gif&#8221;):<br />			$tempHandle = imagecreatefromgif(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);</p>
<p>			if ($CONF["IMAGE_PROCESSOR:GD2"]) $handle = imagecreatetruecolor(imagesx($tempHandle), imagesy($tempHandle)); <br />			else $handle = imagecreate($newSize, $processHeight);</p>
<p>			imagecopy($handle, $tempHandle, 0, 0, 0, 0, imagesx($tempHandle), imagesy($tempHandle));<br />		break;</p>
<p>		/*<br />			Png image<br />		*/<br />		case(&#8220;png&#8221;):<br />			$handle = imagecreatefrompng(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);<br />		break;<br />	}</p>
<p>	/* Process to crop, fill or resize */<br />	switch($CONF["IMAGE_PROCESS_MODE"]) {</p>
<p>		case(&#8220;resize&#8221;):<br />			/*<br />				In resize mode, we will only find the source picture biggest size axis (W/H) and<br />				resize that max value to the required processed size, the other axix is resized<br />				acordingly<br />			*/<br />			list($sourceWidth, $sourceHeight) = getimagesize(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);</p>
<p>			if ($sourceWidth &gt;= $sourceHeight) <br />				$ratio = $newSize / $sourceWidth;<br />			else <br />				$ratio = $newSize / $sourceHeight;</p>
<p>			$thumb = imagecreatetruecolor(round($sourceWidth * $ratio), round($sourceHeight * $ratio));</p>
<p>			imagecopyresampled(<br />				$thumb, <br />				$handle, <br />				0,<br />				0, <br />				0, <br />				0, <br />				round($sourceWidth * $ratio), <br />				round($sourceHeight * $ratio), <br />				$sourceWidth, <br />				$sourceHeight<br />			);</p>
<p>		break;</p>
<p>		case(&#8220;crop&#8221;): default:<br />			/*<br />				The crop mode picks the lowest source axis as its reference,<br />				the second axis is centered and cropped at constrained proportions<br />				values<br />			*/<br />			$thumb = imagecreatetruecolor(<br />				$newSize, <br />				$newHeight = round($newSize * $CONF["IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO"])<br />			);</p>
<p>			list($sourceWidth, $sourceHeight) = getimagesize(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);</p>
<p>			if ($sourceWidth &gt;= $sourceHeight) {</p>
<p>				$intraSourceWidth = round($sourceHeight / $CONF["IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO"]);</p>
<p>				imagecopyresampled(<br />					$thumb, <br />					$handle, <br />					0, <br />					0, <br />					($sourceWidth / 2) &#8211; ($intraSourceWidth / 2),<br />					0,<br />					$newSize, <br />					$newHeight,<br />					$intraSourceWidth,<br />					$sourceHeight<br />				);</p>
<p>			}</p>
<p>			else {</p>
<p>				$intraSourceHeight = round($sourceWidth * $CONF["IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO"]);</p>
<p>				imagecopyresampled(<br />					$thumb, <br />					$handle, <br />					0, <br />					0, <br />					0,<br />					($sourceHeight / 2) &#8211; ($intraSourceHeight / 2),<br />					$newSize, <br />					$newHeight,<br />					$sourceWidth,<br />					$intraSourceHeight<br />				);<br />			}<br />		break;</p>
<p>		case(&#8220;fill&#8221;):<br />			/*<br />				Fill mode resizes the original picture according to its<br />				highest axis to fit the thumbnail size. The lower axis<br />				is then used to center the result into the thumbnail<br />			*/<br />			$thumb = imagecreatetruecolor(<br />				$newSize, <br />				$newHeight = round($newSize * $CONF["IMAGE_CONSTRAIN_PROPORTIONS_ASPECT_RATIO"])<br />			);</p>
<p>			list($sourceWidth, $sourceHeight) = getimagesize(&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/{$fileName}&#8221;);</p>
<p>			if ($sourceWidth &gt;= $sourceHeight) {<br />				$ratio = $newSize / $sourceWidth;</p>
<p>				$intraSourceWidth = $newSize;<br />				$intraSourceHeight = $sourceHeight * $ratio;</p>
<p>				imagecopyresampled(<br />					$thumb,<br />					$handle,<br />					0,<br />					($newHeight / 2) &#8211; ($intraSourceHeight / 2),<br />					0,<br />					0,<br />					$newSize,<br />					ceil($intraSourceHeight),<br />					$sourceWidth,<br />					$sourceHeight<br />				);<br />			}</p>
<p>			else {<br />				$ratio = $newHeight / $sourceHeight;</p>
<p>				$intraSourceHeight = $newHeight;<br />				$intraSourceWidth = $sourceWidth * $ratio;</p>
<p>				imagecopyresampled(<br />					$thumb,<br />					$handle,<br />					($newSize / 2) &#8211; ($intraSourceWidth / 2),<br />					0,<br />					0,<br />					0,<br />					ceil($intraSourceWidth),<br />					$newHeight,<br />					$sourceWidth,<br />					$sourceHeight<br />				);<br />			}</p>
<p>		break;<br />	}</p>
<p>	// IMAGE STAMP /////////////////////////////////////////////////////////////////<br />	if (($CONF["IMAGE_USE_STAMP_TEXT"]) &#038;&#038; ($CONF["IMAGE_STAMP_TEXT"] != &#8220;&#8221;)) {</p>
<p>		/*<br />			Lets just make sure this thumbnail is big enough to welcome<br />			the stamp text.<br />		*/<br />		if ($newSize &gt;= $CONF["IMAGE_STAMP_MINWIDTH"]) {</p>
<p>			/*<br />				Now let&#39;s see where to place that stamp, The following switches<br />				will give a startup position for the stamp X/Y coords<br />			*/<br />			switch($CONF["IMAGE_STAMP_TEXT_LOCATION_Y"]) {<br />				case(&#8220;top&#8221;): <br />					$stampLocationY = 0; <br />				break;</p>
<p>				case(&#8220;middle&#8221;): <br />					$stampLocationY = ($processHeight / 2) &#8211; ($CONF["IMAGE_STAMP_TEXT_SIZE"]/2);<br />				break;</p>
<p>				case(&#8220;bottom&#8221;):	<br />					$stampLocationY = $processHeight &#8211; $CONF["IMAGE_STAMP_TEXT_SIZE"];<br />				break;<br />			}</p>
<p>			switch($CONF["IMAGE_STAMP_TEXT_LOCATION_X"]) {<br />				case(&#8220;left&#8221;): <br />					$stampLocationX = 0; <br />				break;</p>
<p>				case(&#8220;middle&#8221;):	<br />					$stampLocationX = ($newSize / 2) &#8211; ((strlen($CONF["IMAGE_STAMP_TEXT"]) * $CONF["IMAGE_STAMP_TEXT_SIZE"])/2);<br />				break;</p>
<p>				case(&#8220;right&#8221;):<br />					$stampLocationX = $newSize &#8211; (strlen($CONF["IMAGE_STAMP_TEXT"]) * $CONF["IMAGE_STAMP_TEXT_SIZE"]);<br />				break;<br />			}</p>
<p>			/*<br />				Now we add the padding values!<br />			*/<br />			$stampLocationX = $stampLocationX + $CONF["IMAGE_STAMP_TEXT_PADDING_X"];<br />			$stampLocationY = $stampLocationY + $CONF["IMAGE_STAMP_TEXT_PADDING_Y"];</p>
<p>			/*<br />				Are we supposed to add a drop shadow hilight on that?<br />			*/<br />			if ($CONF["IMAGE_STAMP_TEXT_DROPHILIGHT"]) {<br />				/*<br />					Yep! First thing first; find the color code<br />					and attribute it to the handler.<br />				*/<br />				$color = explode(&#8220;,&#8221;, $CONF["IMAGE_STAMP_TEXT_DROPHILIGHT_COLOR"]);<br />				$dropColor = imagecolorallocate($thumb, $color[0], $color[1], $color[2]);</p>
<p>				/*<br />					.. and add the string to the image (as this<br />					is a hilight and that we want it to be under the<br />					other text, we will set it first. How Logic!<br />				*/<br />				imagestring(<br />					$thumb, <br />					$CONF["IMAGE_STAMP_TEXT_SIZE"], <br />					$stampLocationX + $CONF["IMAGE_STAMP_TEXT_DROPHILIGHT_DEPHASE"], <br />					$stampLocationY + $CONF["IMAGE_STAMP_TEXT_DROPHILIGHT_DEPHASE"], <br />					$CONF["IMAGE_STAMP_TEXT"], <br />					$dropColor);<br />			}		</p>
<p>			/*<br />				Now we will add the top layer stamp. Let&#39;s find<br />				that color code and attribute it to the handler.<br />			*/<br />			$color = explode(&#8220;,&#8221;, $CONF["IMAGE_STAMP_TEXT_COLOR"]);<br />			$stampColor = imagecolorallocate($thumb, $color[0], $color[1], $color[2]);</p>
<p>			/*<br />				&#8230; and text that!<br />			*/<br />			imagestring(<br />				$thumb, <br />				$CONF["IMAGE_STAMP_TEXT_SIZE"], <br />				$stampLocationX, <br />				$stampLocationY, <br />				$CONF["IMAGE_STAMP_TEXT"], <br />				$stampColor<br />			);<br />		}<br />	}</p>
<p>	// IMAGE WATERMARK /////////////////////////////////////////////////////////////<br />	if ($CONF["IMAGE_USE_WATERMARK"] and imagesx($thumb) &gt;= $CONF["IMAGE_WATERMARK_MINWIDTH"]) {</p>
<p>		/* Load watermark */<br />		list($srcmarkwidth, $srcmarkheight) = getimagesize(&#8220;cache/pictures/&#8221;.$CONF["IMAGE_WATERMARK_FILE"]);<br />		$tempwmhandler = imagecreatefrompng(&#8220;cache/pictures/&#8221;.$CONF["IMAGE_WATERMARK_FILE"]);</p>
<p>		if ($srcmarkwidth &gt;= $srcmarkheight) {<br />			$wmwidth = (imagesx($thumb) * $CONF["IMAGE_WATERMARK_RESIZE_FACTOR"]) / 100;<br />			$wmheight = round($srcmarkheight * ($wmwidth / $srcmarkwidth));<br />		}</p>
<p>		else {<br />			$wmheight = (imagesy($thumb) * $CONF["IMAGE_WATERMARK_RESIZE_FACTOR"]) / 100;<br />			$wmwidth = round($markheight * ($wmheight / $srcmarkheight));<br />		}</p>
<p>		$watermark = imagecreatetruecolor($wmwidth, $wmheight);<br />		imagecopyresampled($watermark, $tempwmhandler, 0, 0, 0, 0, $wmwidth, $wmheight, $srcmarkwidth, $srcmarkheight);</p>
<p>		imagecolortransparent($watermark, imagecolorallocate($watermark, 0, 0, 0));<br />		imagealphablending($watermark, true);</p>
<p>		/* Put watermark over the picture */<br />		imagecopymerge(<br />			$thumb,<br />			$watermark, <br />			imagesx($thumb) &#8211; $wmwidth &#8211; $CONF["IMAGE_WATERMARK_PADDING"], <br />			imagesy($thumb) &#8211; $wmheight &#8211; $CONF["IMAGE_WATERMARK_PADDING"],<br />			0, <br />			0, <br />			$srcmarkwidth, <br />			$srcmarkheight, <br />			$CONF["IMAGE_WATERMARK_BLEND_VISIBILITY"]<br />		);</p>
<p>		imagedestroy($watermark);<br />	}</p>
<p>	// SAVE CACHE //////////////////////////////////////////////////////////////////<br />	/*<br />		Ok now we want to save a cached version of what<br />		we processed&#8230; well &#8211; Do we?<br />	*/	<br />	if ($CONF["IMAGE_CACHE_PROCESSED"]) {<br />		/* <br />			Simple as one, two, sixteen. We save the cached<br />			result in a jpeg file!<br />		*/<br />		imagejpeg(<br />			$thumb, <br />			&#8220;../&#8221;.$CONF["IMAGE_DEFAULT_DIRECTORY"].&#8221;/CACHE_{$fileName}_W&#8221;.$newSize.&#8221;.jpg&#8221;, <br />			$CONF["IMAGE_QUALITY"]<br />		);<br />	}</p>
<p>	// STREAM BUFFER ///////////////////////////////////////////////////////////////<br />	/*<br />		Now we will stream the image to the browser.<br />	*/<br />	(!$CONF["IMAGE_PROCESSOR_DEBUG_MODE"]?header($CONF["IMAGE_HEADER_STRING"]):NULL);<br />	imagejpeg($thumb, false, $CONF["IMAGE_QUALITY"]);</p>
<p>	/*<br />		And clean the mess <img src='http://www.fliquidstudios.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> <br />	*/<br />	imagedestroy($thumb); <br />	imagedestroy($handle);</p>
<p>?&gt;</p>
<p>And that is the way I get the picture on my web page <br />&#8220;system/image_resize_heigth.php?file={me.mainpicture}&amp;width=260&#8243;<br />Please I need your help.</p>
<p>Best regard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Resizing images in PHP with GD and Imagick &#124; Fliquid Studios</title>
		<link>http://www.fliquidstudios.com/2009/05/07/resizing-images-in-php-with-gd-and-imagick/comment-page-1/#comment-22574</link>
		<dc:creator>Resizing images in PHP with GD and Imagick &#124; Fliquid Studios</dc:creator>
		<pubDate>Thu, 07 May 2009 17:21:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.fliquidstudios.com/?p=270#comment-22574</guid>
		<description>[...] link: Resizing images in PHP with GD and Imagick &#124; Fliquid Studios   Share and [...]</description>
		<content:encoded><![CDATA[<p>[...] link: Resizing images in PHP with GD and Imagick | Fliquid Studios   Share and [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
