Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/02/2010, 10:34
Gissy19
 
Fecha de Ingreso: junio-2009
Mensajes: 32
Antigüedad: 14 años, 10 meses
Puntos: 0
Redimencionar una Imagen

Hola buenos dias mi problema es el siguiente....
tengo un multiupload para subir imagenes al servidor, ahora lo que necesito es que despues de subirlas se redimencionen, para hacer esto utilizo el siguiente codigo pero no funciona si alguien podria ayudarme les agradeceria mucho...
Código PHP:
// Uploadify v1.6.2
// Copyright (C) 2009 by Ronnie Garcia
// Co-developed by Travis Nickels
if (!empty($_FILES)) {
    
$tempFile $_FILES['Filedata']['tmp_name'];
    
$targetPath $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    
$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
    
    
// Uncomment the following line if you want to make the directory if it doesn't exist
    // mkdir(str_replace('//','/',$targetPath), 0755, true);
    
    
move_uploaded_file($tempFile,$targetFile);
    
    
    if (
$targetFile != "")
  {
     
$tam_orig getimagesize($tempFile);    
     
$proporcion $tam_orig[1]/$tam_orig[0]; //altura / ancho
     
$dest '../images/images_g/';
     
$targetPath $_SERVER['DOCUMENT_ROOT'] . $dest '/';
     
$img_dest =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
      
$ancho=$tam_orig[0];
     
$alto=$tam_orig[1];

    if(
$tam_orig[0]>500)
      {
        
$img_final imagecreatetruecolor(500,(($tam_orig[1]*500)/$tam_orig[0]));
        
$img_inicial imagecreatefromjpeg($tempFile);
        
imagecopyresampled($img_final$img_inicial0000500,(($tam_orig[1]*500)/$tam_orig[0]), $tam_orig[0], $tam_orig[1]);
      
       if (
file_exists($img_dest))
         {
           
unlink($img_dest);
         }


        
imagejpeg($img_final$img_dest);
        
imagedestroy($img_final);
      } 
//fin if
   
}