Posted By

nshakin on 05/18/13


Tagged

php


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

IMPGTX


Copy Image From Remote Server To Local


 / Published in: PHP
 

PHP function to save an image from a remote source then download it to the local server that the script is on.

  1. <?php
  2. function save_image($inPath,$outPath)
  3. { //Download images from remote server
  4. $in= fopen($inPath, "rb");
  5. $out= fopen($outPath, "wb");
  6. while ($chunk = fread($in,8192))
  7. {
  8. fwrite($out, $chunk, 8192);
  9. }
  10. fclose($in);
  11. fclose($out);
  12. }
  13. ?>

Report this snippet  

You need to login to post a comment.