Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/03/2009, 12:02
jpneruda
 
Fecha de Ingreso: mayo-2008
Mensajes: 34
Antigüedad: 16 años
Puntos: 1
Respuesta: Problema al subir imagenes al Servidor

Te paso la función que utilizo para redimensionar imagenes:

Código PHP:
function img_redim($filename$width=''$height=''$destino='') {
    
//$tmp = explode("/", $filename);
    //$archivo = $tmp[count($tmp)-1];
    
list($width_orig$height_orig) = getimagesize($filename);
    if(
$width !='' && $width_orig $width) {
        
$height = ($width $width_orig) * $height_orig;
     } elseif(
$height !='' && $height_orig $width) {
        
$width = ($height $height_orig) * $width_orig;
    } else {
        
copy($filename$destino);
        return;
    }

    
$image_p imagecreatetruecolor($width$height);
    
$image imagecreatefromjpeg($filename);
    
imagecopyresampled($image_p$image0000$width$height$width_orig$height_orig);
    
imagejpeg($image_p$destino90);

pd: intenta definir un poco mejor el nombre de las variables, de lo contrario el código se hace difícil de seguir. Suerte!