As pereolat image obtained with cURL?

Good afternoon.

Please tell me a way pereolat image obtained with cURL ?
Now I have a commonplace way to get a picture from exile and pour it on your server.

But the files are large sizes, this interested is there a way to get the picture, to make her resize and then upload to the server ?

Now it works like this:
private function wall_get_img($url) {
 $headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
 $headers[] = 'Connection: Keep-Alive';
 $headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
 $user_agent = 'php';
 $process = curl_init($url);
 curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
 curl_setopt($process, CURLOPT_HEADER, 0);
 curl_setopt($process, CURLOPT_USERAGENT, $user_agent); //check here
 curl_setopt($process, CURLOPT_TIMEOUT, 30);
 curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
 $return = curl_exec($process);
curl_close($process);
 return $return;
}

$image_file = $this->wall_get_img($url);
$image_name = uniqid() . '.jpg';
file_put_contents($_SERVER["DOCUMENT_ROOT"] . '/uploadfiles/' . $image_name, $image_file);


Is there a way before doing file_put_contents, pereolat picture ?
Thanks in advance.
June 5th 19 at 21:59
1 answer
June 5th 19 at 22:01

Find more questions by tags PHP