Hii all i am trying to convert blog string into base64 but i am unable to do that please guys help me to get out from it..
this is my Blob string
$blob="blob:4cfaa6d2-3712-4986-98d7-bd8747d26f8b";
$image = imagecreatefromstring($blob);
ob_start();
imagejpeg($image, null, 80);
$imagedata = ob_get_contents();
ob_end_clean();
$img=base64_encode($imagedata);
and mysql insert query goes here for insert this base_64 encoded image
and i am getting this “error Data is not in a recognized format”
Please help me guys..
Thanks in Advance..
The short string “blob:4cfaa6d2-3712-4986-98d7-bd8747d26f8b” is just a UUID your browser generated to identify a dynamically generated image. Transmitting this ridiculously short string to the server will definitely not transmit the image.
Instead, in your JavaScript, you need to create a FormData object, append the Blob to it, and then POST the FormData object to the server using XMLHttpRequest. The image should arrive at the server as a normal file upload. See Using FormData Objects on MDN for example code.