I usually send image files through cURL as follows:
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:multipart/form-data"));
curl_setopt($ch, CURLOPT_URL, URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("photo" => "@" . FILE_PATH, ));
curl_setopt($ch, CURLOPT_INFILESIZE, filesize(FILE_PATH));
$output = curl_exec($ch);
This works great, the server receives and understands my images.
Instead of sending an image stored on disc, I'd like to send the image stored within an Imagick()
object.
How can I achieve this directly in PHP (without outputting the Imagick
object to disc and sending as above)?
0 comments:
Post a Comment