Thursday 25 October 2018

Buffer.toString() not the same with the original sent data

I am doing a Foto with the webcam and then converting the canvas to a .jpg image. Then I am sending the converted to base64 image to the server and use data.toString() for the conversion back to base 64.I am using the npm package base64ToImage for converting the foto back and saving it. The problem is with the conversion back to base64. The error invalid base64 string is shown.I compared the base64 from client with the one from server and they do not match. Why? So i cant covert the image back.Please help, I am at the end of my patience, as I know the solution has to be easy.As the data has more than 600k caract, I'm only posting a part of it:-this is from the client: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAgAElEQVR4XsS9Wa9kWXodts8QcW9mdlV3cWiyW2yqJXEAKMjwk/XiBz/4zc/+PfaTAVsjRYlNtmXSBvyTDD8IoFqUaEqsrq4xM++9EWcw1vSdHVHVgABxiEYjK/PGjThnn72/vfb61re+4Z/+43+0j+PQHk5zG4ahXa7PbVu3tre1bevatmVv4zi26fTQrtdru+6tTfPUpnFo+763cbu0bd/bNKwNr+104ucsy9a2bWvreOH7tmFr4zS2aT/xfePyin+2febPh3njX6/bkz63DXrfPvLz8OKfw8Kfz+uV13WaR17Xu/XU1mVty9O5Leva9v3c5tPcv-this is from the server: imgBase64=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAgAElEQVR4Xpy9aZMkS3Ic6HFlVfebAZe%2FmSL8sisQEjtczIFjcA24Xyj8aSQx012VGceKXuae%2BRoQyiYE0vO6qzIzItzN1dTU1Kb%2F63d%2Fd23b1t4ej3acR7uuo03T1M71bMs8t2XZ2nVd7XxMDa%2B5nfxzuk7%2B%2FdI%2B2rou%2FB3896O9t8f%2BaB%2FX2uZlbtNjbsEdit: Im trying to format it like code, but I dont know how to make it work

Submitted October 25, 2018 at 01:57PM by Coreeze

No comments:

Post a Comment