There is a link to the image that is uploaded to the server using curl

public function download_remote_file_with_curl($file_url, $save_to) { $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch,CURLOPT_URL,$file_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $file_content = curl_exec($ch); curl_close($ch); $downloaded_file = fopen($save_to, 'w'); fwrite($downloaded_file, $file_content); fclose($downloaded_file); } 

$ file_url - link to the image, $ save_to - directory on my server

Ordinary php loaders do not fit, because there are a lot of pictures, and the RAM ends, the function does not have time to complete.

But the pictures are big, and you need to reduce them. Before uploading to my server, so how to combine it with curl?

  • You can use Imagemagick to upload an image to an address, transform it and then save where necessary. Read the documentation on php.net/manual/ru/imagick.readimagefile.php - Daniel Protopopov
  • @DanielProtopopov and the RAM will not eat? - Vyacheslav Fedorov
  • I do not know, it will be determined only in practice in a specific example - Daniel Protopopov
  • @DanielProtopopov hosting is not installed imagemagick - Vyacheslav Fedorov

0