Posted By

karmacode on 02/09/10


Tagged

import drupal


Versions (?)

Fetching and storing remote image


 / Published in: PHP
 

URL: http://stackoverflow.com/questions/724391/save-image-from-php-url-using-php

  1. $image = drupal_http_request($link);
  2.  
  3. $path_array = explode('/', $link);
  4. $filename = end($path_array);
  5.  
  6. $save_to = file_directory_path().'/_images/'.$filename;
  7. $temp = '/opt/httpd/htdocs/devphp.caribbeantravelmag.com/files/blog/'.$filename;
  8.  
  9. file_put_contents($temp, file_get_contents($link));

Report this snippet  

You need to login to post a comment.