Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/05/2009, 11:42
Avatar de mdk
mdk
 
Fecha de Ingreso: noviembre-2002
Mensajes: 531
Antigüedad: 21 años, 5 meses
Puntos: 11
Problema con imagen

Hace tiempo, consegui un codigo de un libro de php que tengo, en el que me enseñaba y me dejaba redimensionar una imagen que estaba en el servidor. Pero ahora, 1 mes y pico despues, intento mostrar cualquier imagen con el mismo script, o redimensionarla, y me da los siguientes errores.

<br />
<b>Warning</b>: getimagesize(foto000.jpg) [<a href='function.getimagesize'>function.getimagesize </a>]: failed to open stream: No such file or directory in <b>/photos/foto.php</b> on line <b>14</b><br />
<br />
<b>Warning</b>: imagecreate() [<a href='function.imagecreate'>function.imagecreate</a>]: Invalid image dimensions in <b>/photos/foto.php</b> on line <b>24</b><br />
<br />
<b>Warning</b>: imagecreatetruecolor() [<a href='function.imagecreatetruecolor'>function.imag ecreatetruecolor</a>]: Invalid image dimensions in <b>/photos/foto.php</b> on line <b>25</b><br />
<br />
<b>Warning</b>: imagecreatefromjpeg(foto000.jpg) [<a href='function.imagecreatefromjpeg'>function.image createfromjpeg</a>]: failed to open stream: No such file or directory in <b>/photos/foto.php</b> on line <b>26</b><br />
<br />
<b>Warning</b>: imagecopyresized(): supplied argument is not a valid Image resource in <b>/photos/foto.php</b> on line <b>29</b><br />


El código que tengo es el siguiente:
Código PHP:
// Variables que indican el archivo de la imagen y el nuevo tamano
if ($id 10) { $id "000".$id; }
elseif (
$id 100) { $id "00".$id; }
elseif (
$id 1000) { $id "0".$id; }

$filename 'foto'.$id.'.jpg';
$percent 1;

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

// Se obtienen las nuevas dimensiones
list($width$height) = getimagesize($filename);
if (
$type=="low") {
    
$newwidth "118";
    
$newheight "88";
}
else {
    
$newwidth $width $percent;
    
$newheight $height $percent;
}
// Cargar la imagen
$thumb imagecreate($newwidth$newheight);
$thumb imagecreatetruecolor($newwidth$newheight);
$source imagecreatefromjpeg($filename);

// Redimensionar
imagecopyresized($thumb$source0000$newwidth$newheight$width$height);

// Mostrar la nueva imagen
//imagejpeg($thumb); 
para cargar la imagen tengo que poner en la ruta del archivo foto id=numero de fotoy si quiero redimensionarla id=numero de foto&type=low (el erro que sale es el que puse arriba.

Alguien sabe a que puede deberse que falle de golpe el codigo tanto en mi servidor local, como en el externo?
__________________
SoY Lo Ke VeS iNKLuSo KuAnDo No Me VeS ;)