• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copy a remote image with copy(). Good or bad?

#2
[eluser]codex[/eluser]
curl seems to do a better job.

Code:
$file_name = $this->input->post('image_src');
$md5 = md5($file_name . rand());
            
$ch = curl_init($file_name);
$fp = fopen('./assets/photos/'. $md5 .'.jpg', 'w');
            
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
            
curl_exec($ch);
curl_close($ch);
fclose($fp);


Messages In This Thread
Copy a remote image with copy(). Good or bad? - by El Forum - 08-03-2008, 07:56 AM
Copy a remote image with copy(). Good or bad? - by El Forum - 08-03-2008, 09:46 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.