Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/09/2010, 18:12
visona
 
Fecha de Ingreso: febrero-2008
Mensajes: 675
Antigüedad: 16 años, 1 mes
Puntos: 5
move upload con image gd

Hola a todos. Necesito un poco de ayuda para colocar una imagen cambiado el tamaño y otra en tamaño real.
La imagen real me la sube bien, pero lo que no se es como colocar la imagen redimensionada.

Esto es lo que tengo
Código PHP:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
    
          
             
$rnd rand(1,10000);
             
$name $rnd."_".$_FILES["archivos"]["name"];
               
$tmp_name $_FILES["archivos"]["tmp_name"]; 
              
$tamano $_FILES["archivos"]["size"];
              
$tipo $_FILES["archivos"]["type"];       
            
            
            
// reducir tamano
            
            
$file $name;//Nombre de la imagen Original
 
 
function image_gd($file)
{
//Separamos las extenciones de archivos para definir el tipo de ext.
    
$extension explode(".",$file);
    
$ext count($extension)-1;
    
//Determinamos las extenciones permitidas.
        
if($extension[$ext] == "jpg" || $extension[$ext] == "jpeg")
        {
            
$image ImageCreateFromJPEG($file);
        }
        else if(
$extension[$ext] == "gif"){
            
$image ImageCreateFromGIF($file);
        }
        else if(
$extension[$ext] == "png"){
            
$image ImageCreateFromPNG($file);
        }
        else
        {
            echo 
"Error, extencion no permitida";
            die();
        }
 
    
$thumb_name substr($file,0,-5);//nombre del thumbnail
    
$width  imagesx($image);//ancho
    
$height imagesy($image);//alto
 
    
$nueva_anchura  100// Definimos el tamaño a 100 px
    
$nueva_altura = ($nueva_anchura $height) / $width // tamaño proporcional
 
        
if (function_exists("imagecreatetruecolor"))
        {
           
$thumb ImageCreateTrueColor($nueva_anchura$nueva_altura);//Color Real
        
}
        
//En caso de no encontrar la funcion, la saca en calidad media
        
if (!$thumb$thumb ImageCreate($nueva_anchura$nueva_altura);
 
    
ImageCopyResized($thumb$image0000$nueva_anchura$nueva_altura$width$height);
    
header("Content-type: image/jpeg");
    
ImageJPEG($thumb"t_".$thumb_name.".jpg"100);
    
imagedestroy($image);
 
return 
$image;
}
image_gd($file);
// fin de reducir el tamano
            
           
$cate=$_POST['categoria'];

  
$insertSQL sprintf("INSERT INTO $cate (espanol, ingles, sueco, posicion, peque, imagen) VALUES (%s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['espanol'], "text"),
                       
GetSQLValueString($_POST['ingles'], "text"),
                       
GetSQLValueString($_POST['sueco'], "text"),
                       
GetSQLValueString($_POST['posicion'], "int"),
                       
GetSQLValueString("peques/".$thumb"text"),
                       
GetSQLValueString("platos/".$name"text"));

            
//$copy = copy($tmp_name, "platos/".$name);
            
move_uploaded_file($tmp_name"platos/".$file);

         
            
  
mysql_select_db($database_rmaritimo$rmaritimo);
  
$Result1 mysql_query($insertSQL$rmaritimo) or die(mysql_error());

  
$insertGoTo "carta.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));

Alguien que me pueda echar una mano?
Muchas gracias