I'm trying to resize an image I'm getting from a Curl request, but I don't want to save it to a file in order to resize it. This is what I'm trying, but not working:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $remote_file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$picture = curl_exec($ch);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
// And then to resize $picture
$data = htmlspecialchars($picture, ENT_QUOTES);
$data = base64_decode($data);
$im = imagecreatefromstring($data);
$imaget1 = imagescale($im, $maxsize);