Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/03/2011, 15:54
mitrofan
 
Fecha de Ingreso: mayo-2010
Mensajes: 128
Antigüedad: 14 años
Puntos: 13
Problema con thumbnail

Hola, estoy utilizando intentando mostrar una imágen alojada en el servidor, y el problema es que al hacerlo redimensionandola para que salga proporcional me muestra solo el código ascci, no la imagen. Tengo activadas las librarias GD en el PHP.
Dejo la parte del código que interesa

Código:
<?php
require_once("conexion.php");
require_once("funciones.php");
$fechadia = @strtotime($_GET["dia"]);
$imagen=$_GET["anuncio"];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title><?php echo $_GET["titulo"];?></title>
<link href="estilos.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="contenedor">  
  <div id="cabecera">Esta es la cabecera</div>
  <div id="lateralizq">
  <table>
  <tr>
  	<td width="145" align="center"><a href="javascript:window.history.back()">Anterior</a></td>
  </tr>
  <tr>
  	<td align="center"><strong><?php echo strtoupper($_GET["ciudad"]);?></strong></td>
  </tr>
  <tr>
  	<td>
<?php
$sql="select nombre from secciones";
listado($sql,$_GET['ciudad']);
setlocale(LC_TIME,"spanish");
?>
  	</td>
  </tr>
  </table>
  </div>
	<div id="contenido">
          <table width="450">
            <tr>
              <td width="330" align="left"><p style="margin:10px">Enviado el&nbsp;<?php echo strftime("%d de %B del %Y",$fechadia);?>&nbsp;a las&nbsp;<?php echo substr($_GET["hora"],0,-3);?>&nbsp;horas</p></td>
            </tr>
            <tr>
              <td bgcolor="#C2C8E2"><h2 style="margin:0px"><?php echo $_GET["titulo"];?></h2></td>
              <td width="105" bgcolor="#C2C8E2"><h3 style="margin:0px"><?php echo $_GET["precio"];?>&nbsp;Euros</h3></td>            
            </tr>
            <tr>
            	<td colspan="2"><h4 style="margin-top:0px" style="margin:1px">(<?php echo $_GET["tipo"];?>)</h4></td>
            </tr>
            <?php
			// SI EXISTE LA IMAGEN LA MOSTRAMOS
			// COLOCO LA IMAGEN 115 SOLO DEMOMENTO PARA PROBAR SI FUNCIONA Y SABIENDO QUE ESTA EN EL LOCALHOST
			if (file_exists("$_GET[seccion]/$_GET[tipo]/$_GET[anuncio].jpg"))
			{
			?>
            <tr align="center">
              <td align="center" colspan="2"><IMG SRC="http://localhost/bbddfolder/<?php echo $_GET["seccion"];?>/<?php echo $_GET["tipo"];?>/<?php redimensionar_foto('115.jpeg');?>></IMG></td>
            </tr>
            <?php
AQUI LA FUNCION A LA QUE SE LLAMA PARA MOSTRAR LA IMAGEN

Código:
function redimensionar_foto($filename)
{

// Variables que indican el archivo de la imagen y el nuevo tamano

$porcentaje = 0.5;

// Content-type para el navegador
header('Content-type: image/jpeg');

// Se obtienen las nuevas dimensiones
list($width, $height) = getimagesize($filename);
$newwidth = $width * $porcentaje;
$newheight = $height * $porcentaje;

// Cargar la imagen
$thumb = imagecreate($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);

// Redimensionar
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

// Mostrar la nueva imagen
imagejpeg($thumb);
}
Y este es el error:

Enviado el 11 de marzo del 2011 a las 01:00 horas
Nvidia

15 Euros
(Tarjetas Gráficas)
< å·@ã¡NE�kjŸ|3§^}‚Þæm[Qíg¥Bnd8Îy_—#‚síTÇŠž]Î?wôPœµïÅ»2ZM+Â÷ëék4±“ÿ�|WŸD˜Eã/ jz"– ö¤Å;O« ý�c^—L’(åFI]meaÃÐûP='YÓu˾Ó/ »¶~’Bá†}¡äpy~¼Ã[øeq£ê¯|>¹N¥Ök ÿ�¢Ý~R½©Çn˜Ú~jØð'Ä|RgÓoíÛNñˆÅå„ ‚0q¹3ÕrG¸ÈëHoEPEPEPEPEPEPEPEPX0 ñ]Ÿƒô u;µi"8 O¿<§;Q~¸?@ ç¼Ý+ËtXÇĉ·šìÛ%м;)³Ó€V[® ’õ9Ç?îÈ4§à¯ß6¦þ0ñiYüEt˜Ž/Oˆò#Œv88'ÜŽrŽ� P* «Ë{4F¸•#W‘bRÇf!TrH=”´�QE�QE�Wž|Fð,ÚºÅâ? mâ}7÷¶òÇ€g�«nÇ=xìx5èt„q................