[英]How to convert base64 image data to data URL in react native?
I am using react-native-signature-canvas which returns the signature as a base64 image string.我正在使用 react-native-signature-canvas 将签名作为 base64 图像字符串返回。 I want to send it to the API and before that, I want to convert it to the data URL.
我想将其发送到 API,在此之前,我想将其转换为数据 URL。 Can anyone help me?
谁能帮我? Also, I don't want to store the file/image to the local storage..just wanna convert it to the DataUrl and send it to the API.
另外,我不想将文件/图像存储到本地存储..只想将其转换为 DataUrl 并将其发送到 API。
Try below code to convert base64ImageString
to DataUrl
尝试以下代码将
base64ImageString
转换为DataUrl
const DataUrl = `data:image/png;base64,${base64ImageString}`;
Ref: Upload base64 Image to Firebase React native参考:上传 base64 图像到 Firebase 反应原生
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.