Sending the contents of a canvas to a Java server and saving it as an image

前端 未结 4 1591
眼角桃花
眼角桃花 2021-02-09 03:06

Okay, basically I\'ve developed a simple image upload system. The user selects a local image (using the HTML5 File / FileReader API) and has the ability to crop it before confir

4条回答
  •  灰色年华
    2021-02-09 03:44

    You have to replace space with + if your base64Image have space char, then you have to remove data:image/png;base64, from the beginning of the base64Image. Unless you replace space char, you can't get correct Image. then you can use Base64 decode

    yourBase64String = yourBase64String.replace(' ', '+');

    yourBase64String = yourBase64String.substring(22);

提交回复
热议问题