<?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: Thumb con PHP y si es necesario recortar la imagen</title>
	<atom:link href="http://www.giancarlospot.com/php/thumb-con-php-y-si-es-necesario-recortar-la-imagen.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.giancarlospot.com/php/thumb-con-php-y-si-es-necesario-recortar-la-imagen.html</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 02:30:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: giancarlo</title>
		<link>http://www.giancarlospot.com/php/thumb-con-php-y-si-es-necesario-recortar-la-imagen.html/comment-page-1#comment-2419</link>
		<dc:creator>giancarlo</dc:creator>
		<pubDate>Mon, 15 Aug 2011 16:37:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.giancarlospot.com/?p=247#comment-2419</guid>
		<description>Pero claro que no vas a poder hacerle un echo, mira solo si la imagen fue guardada...</description>
		<content:encoded><![CDATA[<p>Pero claro que no vas a poder hacerle un echo, mira solo si la imagen fue guardada&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ariel</title>
		<link>http://www.giancarlospot.com/php/thumb-con-php-y-si-es-necesario-recortar-la-imagen.html/comment-page-1#comment-2389</link>
		<dc:creator>ariel</dc:creator>
		<pubDate>Sat, 13 Aug 2011 00:24:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.giancarlospot.com/?p=247#comment-2389</guid>
		<description>hola antes que nada gracias por el aporte, pero consulto, intenté usar la función y lo hice de manera siguiente:

$c= &quot;select * from usuarios &quot;;
$r= mysql_query($c) or die (mysql_error());
$n= mysql_num_rows($r);
$row= mysql_fetch_array($r);

$image=($row[&#039;imagen&#039;]);

$pImageOrigen= $image;
echo $pImageOrigen; //esto lo puse solo a modo de prueba

$pImageDestino= $image; /* se me ocurrió que debia hacerlo asi, no se si está bien*/
$pWidth= 40; // no se si estaran bien asignados los parámetros
$pHeight= 40;
$pMaxWidth= 40;
$pMaxHeight= 40;
$pCalidad= 100;

function CreateThumb($pImageOrigen, $pImageDestino, $pWidth, $pHeight, $pMaxWidth, $pMaxHeight, $pCalidad){
		// SI WIDTH ES MAS ALTO, LO CORTO POR WIDTH Y VICEVERSA
		if($pWidth &gt; $pHeight){
			$_porcentaje = $pMaxHeight*100/$pHeight;
			$_height = $pMaxHeight;
			$_width = ceil($_porcentaje*$pWidth/100);
		}else{
			$_porcentaje = $pMaxWidth*100/$pWidth;
			$_width = $pMaxWidth;
			$_height = ceil($_porcentaje*$pHeight/100);
		}
		$_pic = @imagecreatefromjpeg($pImageOrigen);
		$_tmp = imagecreatetruecolor($pMaxWidth, $pMaxHeight);
		imagecopyresized($_tmp, $_pic, 0, 0, 0, 0, $_width, $_height, $pWidth, $pHeight);
		imagejpeg($_tmp, $pImageDestino, $pCalidad);
		imagedestroy($_pic);
		imagedestroy($_tmp);
	}
	
	echo CreateThumb($pImageOrigen, $pImageDestino, $pWidth, $pHeight, $pMaxWidth, $pMaxHeight, $pCalidad);
/*intenté visualizar la imagen mediante un echo a la función pero el resultado fue nulo, o sea no se visualizó nada, que es lo que estoy haciendo mal? agradecería muchisimo la ayuda para poder resolver el problema, saludos y mil gracias/*</description>
		<content:encoded><![CDATA[<p>hola antes que nada gracias por el aporte, pero consulto, intenté usar la función y lo hice de manera siguiente:</p>
<p>$c= &#8220;select * from usuarios &#8220;;<br />
$r= mysql_query($c) or die (mysql_error());<br />
$n= mysql_num_rows($r);<br />
$row= mysql_fetch_array($r);</p>
<p>$image=($row['imagen']);</p>
<p>$pImageOrigen= $image;<br />
echo $pImageOrigen; //esto lo puse solo a modo de prueba</p>
<p>$pImageDestino= $image; /* se me ocurrió que debia hacerlo asi, no se si está bien*/<br />
$pWidth= 40; // no se si estaran bien asignados los parámetros<br />
$pHeight= 40;<br />
$pMaxWidth= 40;<br />
$pMaxHeight= 40;<br />
$pCalidad= 100;</p>
<p>function CreateThumb($pImageOrigen, $pImageDestino, $pWidth, $pHeight, $pMaxWidth, $pMaxHeight, $pCalidad){<br />
		// SI WIDTH ES MAS ALTO, LO CORTO POR WIDTH Y VICEVERSA<br />
		if($pWidth &gt; $pHeight){<br />
			$_porcentaje = $pMaxHeight*100/$pHeight;<br />
			$_height = $pMaxHeight;<br />
			$_width = ceil($_porcentaje*$pWidth/100);<br />
		}else{<br />
			$_porcentaje = $pMaxWidth*100/$pWidth;<br />
			$_width = $pMaxWidth;<br />
			$_height = ceil($_porcentaje*$pHeight/100);<br />
		}<br />
		$_pic = @imagecreatefromjpeg($pImageOrigen);<br />
		$_tmp = imagecreatetruecolor($pMaxWidth, $pMaxHeight);<br />
		imagecopyresized($_tmp, $_pic, 0, 0, 0, 0, $_width, $_height, $pWidth, $pHeight);<br />
		imagejpeg($_tmp, $pImageDestino, $pCalidad);<br />
		imagedestroy($_pic);<br />
		imagedestroy($_tmp);<br />
	}</p>
<p>	echo CreateThumb($pImageOrigen, $pImageDestino, $pWidth, $pHeight, $pMaxWidth, $pMaxHeight, $pCalidad);<br />
/*intenté visualizar la imagen mediante un echo a la función pero el resultado fue nulo, o sea no se visualizó nada, que es lo que estoy haciendo mal? agradecería muchisimo la ayuda para poder resolver el problema, saludos y mil gracias/*</p>
]]></content:encoded>
	</item>
</channel>
</rss>

