Stuck in a loop of ImageSource / ImageAsset / camera / file upload issues


#1

I’m trying to take a picture with the nativescript-camera plugin and upload it.

It returns the image as ImageAsset - this is where my problems begin.

From what I understood and read, working with binaries and multipart/form-data is not possible at this time, only through the nativescript-background-http plugin - but I can’t even do it that way, because when I create the ImageSource from the ImageAsset returned by the camera plugin, it gets resized to a very tiny image on android.

So I’m trying right now to go the base64 way since it would be simpler. But I can’t do that either, since ImageAsset doesn’t have any base64 conversion method. If I go through ImageSource it gets resized again.

I found a partial hint in this github issue, but that’s where I’m left with native android/ios objects and no way to convert them to base64.


I’m not sure if I’m going the right way about this - is there a simpler solution?
tl;dr - I need to upload a full-size image taken from the device camera through http.