Ver Mensaje Individual
  #7 (permalink)  
Antiguo 09/01/2004, 22:10
jmaribau
 
Fecha de Ingreso: enero-2004
Mensajes: 235
Antigüedad: 20 años, 3 meses
Puntos: 0
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$fuente0,0$ancho$alto$img_ancho$img_alto);
    } else {
        
$imagen ImageCreateTrueColor($ancho,$alto);
        if (
$metod) {
            
ImageCopyResized$imagen$fuente0000$ancho$alto$img_ancho$img_alto);
        } else {
            
ImageCopyResampled$imagen$fuente0000,  $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);