Closed slangdog closed 7 years ago
I've tried replacing 'media' with 'media_data' in the array. Still get the same error:
string(22) "/1.1/media/upload.json" ["error"]=> string(24) "media type unrecognized."
media_data accepts this:
$image = str_replace('data:image/png;base64,', '', $image);
I want to post an image created using HTML Canvas to users timeline without first saving onto server. No problem getting the image string into the PHP script, but how would I go about converting it to use with media_upload method?
$reply = $cb->media_upload(array('media' => $image));
example of $image (truncated):
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArwAAAK8CAYAAAANumxDAAAgAElEQVR4Xuy9WbBl53UetvZwzrlz3+7b84juBtCYCBADCZIixUGkRMuaJSuRbMVxpKSkchQ/xHlJ5TGVl6TKL1Gq4li2S7YVR5GURBI1UDTFeQRBAmiggZ7R83jn8Zw9pL5vrbX3f849d+yGVE7cKhHd956z97//fw3f+tawo7xsl2VRyKo/USRRFK3+OX8S2/9GUopIyf/VP/hGJPi5/h9++9fxB/fU1ebb...