Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/01/2009, 12:17
Avatar de cooosmos
cooosmos
 
Fecha de Ingreso: marzo-2007
Ubicación: mexico
Mensajes: 54
Antigüedad: 17 años, 2 meses
Puntos: 4
funcion para imagenes no funciona

uso una funcion en mi pagina, es para redimensionar imagenes.

Me esta funcionando todo correctamente, el unico detalle es que cuando intento subir una foto grande, se tarda mucho y despues marca error

Cita:
Warning: getimagesize(pics/cooosmosCBXA5.JPG) [function.getimagesize]: failed to open stream: No such file or directory in /home/public_html/functions.php on line 234

Warning: Division by zero in /public_html/functions.php on line 239

Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /public_html/functions.php on line 241

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/public_html/functions.php on line 242

Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/public_html/functions.php on line 243

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/public_html/functions.php on line 249
este es el codigo de la funcion:

Código PHP:
function redimImagen($path,$fileImagen)
{

    
$imagenMini $fileImagen;
    
$anchura=400;
    
$hmax=500;
    
$nombre=$path.$fileImagen;
    
$datos getimagesize($nombre);
    if(
$datos[2]==1){$img = @imagecreatefromgif($nombre);}
    if(
$datos[2]==2){$img = @imagecreatefromjpeg($nombre);}
    if(
$datos[2]==3){$img = @imagecreatefrompng($nombre);}
    
$ratio = ($datos[0] / $anchura);
    
$altura = ($datos[1] / $ratio);
    
//if($altura>$hmax){$anchura2=$hmax*$anchura/$altura;$altura=$hmax;$anchura=$anchura2;}
    
$thumb imagecreatetruecolor($anchura,$altura);
    
imagecopyresampled($thumb$img0000$anchura$altura$datos[0], $datos[1]);
    
imagejpeg($thumb,$path.$imagenMini,100);
    
# eliminamos la imagen original
    //unlink($path.$fileImagen);
    //if($datos[2]==1){header("Content-type: image/gif"); imagegif($thumb);}
    //if($datos[2]==2){header("Content-type: image/jpeg");imagejpeg($thumb);}
    //if($datos[2]==3){header("Content-type: image/png");imagepng($thumb); }
    
imagedestroy($thumb);

Recalco solo falla el codigo cuando suba imagenes por ejemplo de 2.81 MB (2,949,601 bytes) y extensiones de 3072x2304