Closed Fusaige closed 6 years ago
Can you tell me what's your intent for getting binary data of image file? As we know, JavaScript is not easy to process binary data, so we didn't provide an interface for this situation.
If you want to display image on view, you can just use <image>
tag with src
attribute, or if you wanna upload file to server, you can use nat-transfer module.
I wantna upload file to server,In iOS project, I got path ,such as "nat://static/image/887C95DB-3BE9-41AF-A1F9-455C24D7ABA3/L0/001",how can use nat-transer.
weex plugin add nat-transfer
import Nat from 'natjs'
Nat.upload('http://uploader.example.com', { // server api url
path: 'nat://static/image/887C95DB-3BE9-41AF-A1F9-455C24D7ABA3/L0/001', // file path
method: 'POST', // http method
formData: {
framework: 'weex/nat'
},
headers: {
'x-app': 'nat/0.0.8',
'x-sign': 'bfbbf4c1f087d972'
}
}, {
onProgress: (p) => {
console.log('Progressing: ' + p)
}
}, (err, ret) => {
console.log(ret)
})
When I use "nat-media-image" plugin, not all photos show in android app. code: nat.image.pick({ limit: 1, quality: 50, showCamera: true }, (err, ret) => { }); android version: 5.0
This is a known bug, we tried to fix it, but it still happen on some Android devices. We might be able to fix the bug more easily if you can provide these image files and particular device info to us.
fixed
Invoke the “pick” method,I haved the image paths,but how to get the image binary data?