Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/04/2008, 14:06
ferjcuevas
 
Fecha de Ingreso: enero-2008
Mensajes: 25
Antigüedad: 16 años, 3 meses
Puntos: 0
Exclamación imagenes en miniatura me salen en negro

Saludos

Tengo una aplicacion en PHP que sube las imagenes a una carpeta y a la vez, genera una miniatura de 150 x 113, pero la miniatura sale con fondo negro y no captura la imagen.. que puede ser el problema y cómo se puede solucionar? Aqui paso el codigo:

<?
if (isset($subir)) {
header("Location: subir.php");
}
?>
<?
$subir = $_FILES['subir']['name'];

$direct = "pics/";
$nombre1 = $_FILES['subir']['name'];
//copiar archivo
move_uploaded_file( $_FILES['subir']['tmp_name'], $direct.$nombre1 );

//borrar temp file
@unlink($_FILES['subir']['tmp_name']);
?>
<?php
// File and new size
$otogra = $_FILES['subir']['name'];
$filename = $otogra;
//$percent = 0.5;

// Content type
header('Content-type: image/jpeg');
header('Content-type: image/jpg');
header('Content-type: image/gif');

// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = 150;
$newheight = 113;

// Load

$nombre = "thumb_".$filename;
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);

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

// Output
@imagejpeg($thumb, $nombre, 80);
@imagejpeg($thumb, '', 80);
@imagedestroy($nombre);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
GRACIAS.. GRACIAS!!
</body>
</html>