Me esta funcionando todo correctamente, el unico detalle es que cuando intento subir una foto grande, se tarda mucho y despues marca error
Cita:
este es el codigo de la funcion: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
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
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, $img, 0, 0, 0, 0, $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);
}