Cluster, analicé lo que me pasaste, hice algunos cambios y funcionó.
PAso los scrips por si a alguien le interesa:
Archivo: test.php Código PHP:
<?php
echo '<TABLE>';
echo '<TR>';
echo '<TD>Esta es la imagen 1</TD>';
//echo '<TD>'.tn_create('imagen1.jpg',50,50).'</TD>';
echo '<TD><img src="tn_create.php?image=imagen1.jpg"></TD>';
echo '</TR>';
echo '<TR>';
echo '<TD>Esta es la imagen 1</TD>';
//echo '<TD>'.tn_create('imagen1.jpg',50,50).'</TD>';
echo '<TD><img src="func_tn_create.php?image=imagen2.jpg"></TD>';
echo '</TR>';
echo '</TABLE>';
?>
Archivo: create_tn.php Código PHP:
<?php
$image=$HTTP_GET_VARS['image'];
$max_width=80;
$max_height=60;
//Tomo las dimensiones de la imagen original
$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];
//Calculo el ratio
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
//Si la imagen original supera el tamaño del tn, calculo $tn_width y $tn_eight--
if ( ($width <= $max_width) && ($height <= $max_height) )
{
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height) < $max_height)
{
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else
{
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
//------------------------------------------------------------------------
$src = ImageCreateFromJpeg($image);//Crea una imagen temporal en el servidor
$dst = ImageCreate($tn_width,$tn_height); //Crea una imagen en blanco del tamaño del tn
//Copio la imagen temporal dentro de la imagen destino, adaptando el tamaño
ImageCopyResized($dst, $src, 0, 0, 0, 0,$tn_width,$tn_height,$width,$height);
//Creo directamente una salida para el navegador
header('Content-type: image/jpeg');
ImageJpeg($dst, null, -1);
//Destruyo las imagenes temporales
ImageDestroy($src);
ImageDestroy($dst);
?>
Bueno esto funciona joya.
Lo único que no me termina de cerrar, es por que el anterior método anterior de declararlo en el mismo archivo como una funcion con el método require, no funcionaba.
SAludos