You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
ignaciolarranaga
changed the title
It shows images from the library but gets an error when try to use them (iOS)
It shows images from the library but gets an error when try to use them (iOS / not local images)
Dec 12, 2016
Hi @ignaciolarranaga,
Thank you for reporting this issue.
I reviewed this case and indeed images from the cloud do not have fileUri and you should make one extra step. You could use getImage(), which will return imageSource. then you could save it on the device with saveToFile(<file_path>, <file_type>). As a result you will be able to use the saved image path to upload it with nativescript-background-http. I will review the sample-ImageUpload plugin and will make the needed changes. I am attaching sample code with the above-given suggestion.
var counter= 0;
function startSelection(context) {
context
.authorize()
.then(function() {
imageItems.length = 0;
return context.present();
})
.then(function(selection) {
selection.forEach(function(selected_item) {
selected_item.getImage().then(function(imagesource){
let folder = fs.knownFolders.documents();
let path = fs.path.join(folder.path, "Test"+counter+".png");
let saved = imagesource.saveToFile(path, "png");
if(saved){
imageItems.push({thumb:imagesource});
var test = sendImages("", path);
}
counter++;
})
});
//list.items = selection;
}).catch(function (e) {
console.log(e);
});
}
Steps to reproduce:
When you try to use them (for example upload them) there is no fileUri then not usable.
Here is the log for example of one of them:
The text was updated successfully, but these errors were encountered: