【发布时间】:2021-09-04 22:44:50
【问题描述】:
这是我的 react 原生版本 反应原生 cli:2.0.1 反应原生:0.63.4
可以请人帮忙吗?我尝试了很多方法来将我的文件从移动设备更改为 base64 或 blob 发送到服务器 但是没有人可以将我的文件更改为 base 64 或 blob
这是我的控制台日志:路径:看起来像 file:///storage/emulated/0/DCIM/b01f3aef-4b56-48d9-b7a2-e3424df0f054.jpg --------IMAGEURI
是的,这是一个图像 uri,我可以通过调用将其显示在我的手机屏幕上
<Image uri={that file path...}/>
for (var i = 0 ; i < entriesImage.length ; i++){
IdImage = [i][0]
LabelImage = entriesImage[i][0]
ImageUri = entriesImage[i][1].uri
Notes = entriesImage[i][1].notes
Latitude = entriesImage[i][1].location.latitude
Longitude = entriesImage[i][1].location.longitude
//DateImage = entriesImage[i][1].date
DateImage = new Date()
console.log(ImageUri,'--------IMAGEURI')
objImage = {
"surveyId": "3",
"photo": entriesImage[i][1].uri,
"photoId": [i][0],
"label": entriesImage[i][0],
"latitude": entriesImage[i][1].location.latitude,
"longitude": entriesImage[i][1].location.longitude,
"photoDate": DateImage,
"notes": Notes
}
arrayImage.push(objImage)
}
console.log(ImageUri,'--------IMAGEURI'), ImageUri 作为我想发送到服务器的文件路径
但在如何转换为 base64 或 blob 方面仍然没有运气
我也试过expo image manipulator,也没有成功,请帮忙
【问题讨论】:
标签: image react-native base64 expo