Getting image using cURL


I’m trying to get image using cURL:

$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

$image = curl_exec($ch);

But for example if I want to change image size using php, I neet to convert this data which I got. As it is said in php manual I need “an image resource, returned by one of the image creation functions, such as imagecreatetruecolor()”. How can I do this?


You know, PHP net has a lot of documentation, including a way to look up the functions…

…since $image is a string, don’t you think imagecreatefromstring is what you’re looking for?

:cool: -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


Of course!
My mistake, I misspelled one variable, but now it works.