Lo pongo otra vez que no ha salido identado:
Código PHP:
if ($_GET['src']) {
$valores = array('method','ruta','ancho','alto','guardar','calidad');
$i=0;
foreach ($_GET as $key=>$val) {
$$valores[$i++]=$val;
}
unset($i,$key,$val);
if (!$calidad) $calidad = 85;
$prop=GetImageSize($ruta);
$img_ancho = $prop[0];
$img_alto = $prop[1];
$img_tipo = $prop[mime];
$gd_function_suffix = array(
'image/pjpeg'=>'JPEG',
'image/jpeg' =>'JPEG',
'image/gif' =>'GIF' ,
'image/bmp' =>'WBMP',
'image/x-png'=>'PNG');
$function_suffix = $gd_function_suffix[$img_tipo];
$function_to_read = 'ImageCreateFrom'.$function_suffix;
$function_to_write = 'Image'.$function_suffix;
$fuente = $function_to_read($ruta);
//$fuente = ImageCreateFromJPEG($ruta);
$func='imagecreatetruecolor';
if (!Function_Exists($func)) {
$imagen=ImageCreate($ancho,$alto);
ImageCopyResized( $imagen, $fuente, 0 , 0 , 0,0, $ancho, $alto, $img_ancho, $img_alto);
} else {
$imagen = ImageCreateTrueColor($ancho,$alto);
if ($metod) {
ImageCopyResized( $imagen, $fuente, 0, 0, 0, 0, $ancho, $alto, $img_ancho, $img_alto);
} else {
ImageCopyResampled( $imagen, $fuente, 0, 0, 0, 0, $ancho, $alto, $img_ancho, $img_alto);
}
}
$nombre=BaseName($_GET['src']);
if (!$guardar) {
Header("Content-type: $img_tipo");
Header("Content-Disposition: inline; filename=$nombre;");
} else {
$guardarendisco=$nombre;
}
$function_to_write($imagen, $guardarendisco, $calidad);
//ImageJpeg($imagen,$guardarendisco,$calidad);
imageDestroy($imagen);