I am writing a mobile app with Phonegap. I have to change an image when the user selects a new one from the gallery. Then I send it to the server in base64. The server receives my image correctly and when I ask for it, it gives me the image encoded in base64 format correctly. I've tried to paste the result on an online converter and it returns the correct image.
My problem is: when I receive back the image as a base64 string, I have to set the "src" attribute and I am doing it like this with jQuery:
$('#immagineprova').attr('src', "data:image/png;base64," + result.img);
The result is what I get back from my server request. Everything is working fine in a browser, but when I run my application with "phonegap run android", the image is not displayed.
I tried to copy the value of result.img, ie. what I get back from the server, and paste it in place of result.img and it works. Of course in this way it will always show the same image and I have to show what user selected instead.
How can I fix my issue?