nativescript-photo-editor icon indicating copy to clipboard operation
nativescript-photo-editor copied to clipboard

Cannot get the captured image in order to pass it to the PhotoEditor

Open jpw9 opened this issue 5 years ago • 2 comments

hello, i am using nativescript-camera plugin to capture an image and i am saving the resulting ImageAsset and usging ImageSource, i am doing the below to save to file: ImageSource.fromAsset(picture).then( savedImage => { let filename = "image" + "-" + new Date().getTime() + ".png"; let folder = fsModule.knownFolders.documents(); let path = fsModule.path.join(folder.path, filename); savedImage.saveToFile(path, "png"); ..... This is the path: path:/data/user/0/org.nativescript.preview/files/image-1586246616272.png

Now i am trying to access this image in order to pass it to the PhotoEditor instance as per the below: var loadedImage = ImageSource.fromFileSync(path); //same path of the saved Image photoEditor.editPhoto({ imageSource: loadedImage }).then((newImage: ImageAsset) => { .... }).catch((e) => { console.error(e); }); But i am always failing to get the loadedImage. Is there anything i am missing? i am using nativescript angular project and NS version is 6.4.1

jpw9 avatar Apr 07 '20 08:04 jpw9

@jpw9 , dont think this issue is related to the photo-editor plugin. It could be a problem with the file not fully saved when you try to load it, path being overwritten or something else. I suggest you debug your code and check if the path is the same and make sure the image is fully saved before the edit method is called.

PeterStaev avatar Apr 10 '20 13:04 PeterStaev

thank you for your reply. i will try to check with the path to make sure nothing is being overwritten and i am getting the right path.

jpw9 avatar Apr 10 '20 20:04 jpw9