Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/01/2004, 12:38
jmaribau
 
Fecha de Ingreso: enero-2004
Mensajes: 235
Antigüedad: 20 años, 3 meses
Puntos: 0
Pregunta Variable-Función

Es parte de una funcion que crea thumbnails, y uso una variable que contiene un nombre valido de funcion.

Al final de la ejecucion contiene
$function_to_read = 'ImageCreateFromJPEG';

Si realmente no uso la variable-funcion, sinó la función imagecreatefromJPEG() me funciona bien, en cambio usando la variable funcion, no.

Código PHP:
$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);