I am having a heck of a time getting a script to convert images to
work....it worked fine for a few hours, then someone "tweaked it" and now it
doesn't work and I can't get it back...they "tweaked" the original file....

The script runs and uploads files but no longer "converts" them with the
ImageMagick..wondering if anyone else has run into this....

Code:
----------------------------------------------

// ---------------------------------- Get Images from
folder--------------------------- //

     $FileName = $row['Image'];   

     $ImageName = $row['Image'];
     
     $ImageName = str_replace("/",
"", $ImageName);
     
     
     
     //the many confusing paths
     

//Local path on localhost of image names with NO file extenstion on them as
seen through the webserver
     $FilePath =
"http://127.0.0.1/HarrisAutomate/output/WebImagesHiRes/test/$ImageName";;

    
     
     //same as $SysPath not sure why - as of this point
$FileName and $ImageName are the same thing
     $FullSysPath =
"C:/Inetpub/wwwroot/HarrisAutomate/output/WebImagesHiRes/test/$ImageName";

     $BackupPath =
"C:/Inetpub/wwwroot/HarrisAutomate/output/WebImagesHiRes/backup/test/";
  


    //add jpg extenstion to the filename stored in the harris folder
    

$FileName = str_replace("/", "", $FileName);
      
      $FileName =
str_replace(".jpg", "", $FileName);
     
     
      $FileName =
str_replace("/", "", $ImageName);
      $FileName = str_replace(".jpg", "",
$ImageName);
      
       //actual path to the files with NO file extension
as found on the hard drive
     $SysPath =
"C:/Inetpub/wwwroot/HarrisAutomate/output/WebImagesHiRes/test/$FileName";

     
     
      //lets do some echos
  echo $FileName .'<br>';
  echo
$ImageName  .'<br>';

// include ("VariableReveal3.php");

  
echo
($FileName) . '<br />';
echo ($FilePath) . '<br />';
echo '<img src="' .
$FilePath .'">' . '<br />';

     if (file_exists($SysPath))   {
    echo
"The file $ImageName Exists!! Hooray!!"  . '<br />';
    
    
} else {

echo "The file $FileName located at $SysPath does not exist"  . '<br
/>';
}




//----------------------------------If they exist go ahead and convert them
WINDOWS VERSION----------------------------//


    if (file_exists($SysPath)) {
      
      
       $command =
"convert.exe mogrify -format eps *.jpg -normalize -density 200x200 -trim
-resize 150 -colorspace rgb -filter Sinc -quality 100 ├▒trim -identify
-verbose ";
        $command .= addslashes($SysPath . $FileName) ." ";

$command .= addslashes($FilePath . $FileName) .".jpg";
       
          /*

$command = "convert.exe -normalize -density 200x200 -trim -resize 150
-colorspace rgb -filter Sinc -quality 100  -identify -verbose ";

$command .= addslashes($SysPath) ." ";
          $command .=
addslashes($FullSysPath) ." ";
         */
          
//echo the command for
the image not so magick
   echo $command . "<br />";


//--------------------------Error Reporting about the
Conversions---------------------------------//



    if (system($command, $status) === false) {
            echo ($command).
'<br />';
            
     echo "Image Failed" . '<br />';
    } else {

echo "Image Processed" . '<br />';
  }


 


//-------------------------------Once Converted Then connect to the php
server online----------------------------//


$ftp_server = "20.20.20.20.";

 $ftp_user_name = "blah blah ";

 $ftp_user_pass = "blahblah";
        

 $conn_id = ftp_connect($ftp_server);

  $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);


$FilePath =  
"http://127.0.0.1/HarrisAutomate/output/WebImagesHiRes/$FileName";;

$remote_path = "/httpdocs/Announcements/photos/obitsTest/$ImageName";


echo "I'm going to upload $FilePath to $remote_path." . '<br />';


set_time_limit(120);
        ftp_pasv($conn_id, true);

        // upload a
file
        if (ftp_put($conn_id, $remote_path, $SysPath, FTP_BINARY)) {

echo "successfully uploaded $ImageName\n";
                } else {

echo "There was a problem while uploading $ImageName\n";
            }


 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to