I am trying to save a dynamically generated image on an outside server to a
local file on my server using the code below:

 $fc = fopen($image_filename, "wb");
 $file = fopen ($image_url, "rb");

 if (!$file) {
  echo "<p>Unable to open remote file.\n";
  exit;
 }else{
  while (!feof ($file)) {
   $line = fread ($file, 1028);
   fwrite($fc,$line);
  }
 }
 fclose($fc);
        fclose($file);


$image_filename is a locally referred to file, such as "../images/file1.png"
and $image_url is an absolute address, such as
"http://www.whatever.com/imagecreate.php";.

Instead of saving when I run the script through a browser, the image
displays within the browser, and the script creates a file containing only
"427" on the server.  Any ideas why or what I can do to correct this?

Jeremiah



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

Reply via email to