I found this script but It doesn't run when I use a gif.
It's saving the *.gif like a temp.gif but when It supposed to do the thumbnail 
It's not doing anithing.
Please help me

            function 
scaleImageByWidth($image_file,$image_name,$image_path,$ext, $fpath, 
$userid_post)
            {
                    /*echo 
"<script>alert('$image_file,$image_name,$image_path');</script>"; */

                    global $jpegtopnm, $pngtopnm, $giftopnm, $pamscale, 
$pnmtojpeg, $pnmtopng, $pnmtogif;
                                            
                    
                    $imageinfo            = getimagesize($image_file);
                    $image_r_name    = $image_path.'temp'.$ext;
                    //$image_r_name    = $image_path.$image_name.$ext;
        
                    $image_path        .= $image_name;
        
                    $newwidth        = 100;
                    
                    $image_file        = escapeshellarg($image_file);
                    $newfile_r        = escapeshellarg($image_path);
        
                    if ($imageinfo['mime'] == 'image/jpeg') //jpg
                    {
                            $execstr = "{$jpegtopnm} {$image_file} | 
{$pamscale} -width={$newwidth} | {$pnmtojpeg} > {$newfile_r}";
                            exec($execstr);
                    }
                    else if ($imageinfo['mime'] == 'image/png')//png
                    
                                exec("{$pngtopnm} {$image_file} | {$pamscale} 
-width={$newwidth} | {$pnmtopng} > {$newfile_r}");
                                
                    else if ($imageinfo['mime'] == 'image/gif') {//gif
                                //exec("{$giftopnm} {$image_file} | {$pamscale} 
-width={$newwidth} | {$pnmtogif} > {$newfile_r}");
                                //exec("{$giftopnm} {$image_file} | {$pamscale} 
-width={$newwidth} | {$giftojpeg} > {$newfile_r}");
                                exec("/usr/bin/mogrify -format gif -path " . 
$fpath. "$userid_post -thumbnail " . $newwidth. "x100 " . $newfile_r);          
      
                                                            
                                }
                    else if ($imageinfo['mime'] == 'image/bmp')//bmp            
                    
                                exec("/usr/bin/mogrify -format bmp -path ". 
$fpath. "$userid_post -thumbnail " . $newwidth . "x100 " . $image_file);
                    else    
                    {
                                echo "File type cannot be converted";
                    }
                    //@unlink($image_r_name);
            }


if($_FILES["photoname"]["name"] !="")
    {
        echo "<div id='upload_file'  style='width: 150px;  visibility:hidden; 
position: relative; margin-top:-65%; right:0px; zoom: 1; z-index:200'>";
        
        $fpath = "/var/www/html/glabber.com/resources/comment_store/";
    
        if(!is_dir($fpath.$_POST["targetuser"]))
            mkdir($fpath.$_POST["targetuser"],0777);

        // move (actually just rename) the temporary file to the real name

    echo "<div id='upload_file'  style='width: 150px;  visibility:hidden; 
position: relative; margin-top:-65%; right:0px; zoom: 1; z-index:200'>";
       echo "uploading...";

         $userid_post    = $_POST["targetuser"];
        $pos                = strrpos($_FILES["photoname"]["name"], '.');
        $filename        = substr($_FILES["photoname"]["name"], 0, $pos);
        $ext                = strtolower(substr($_FILES["photoname"]["name"], 
$pos));
         
        $image_path    = $fpath.$_POST["targetuser"]."/";
        //$image_file    = $fpath.$_POST["targetuser"]."/temp$ext";
        $image_file    = $fpath."/temp$ext";
    
         
       if(move_uploaded_file($_FILES["photoname"]["tmp_name"],$image_file))
            {
                chmod($image_file, 0777);
                $image_name = $_FILES["photoname"]["name"];                     
               
                scaleImageByWidth($image_file,$image_name,$image_path,$ext, 
$fpath, $userid_post);                    
                header("Location: /home.php");                                  
  
            }
            else  
            {
                echo "error uploading file";
                echo "<script language='javascript'>window.close();</script>";
            }
        
   
   echo "</div>";
    }
else
    {
    echo "<script language='javascript'>window.close();</script>";
    }

 

Danitzel Jurado 
   
  celular: 6727-0315

       
---------------------------------

¡Capacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:
http://correo.espanol.yahoo.com/

[Non-text portions of this message have been removed]

Reply via email to