hazemhagrass / phonegap-base64

Plugin to get base64 encoding of any IMAGE, Base64 can be retrieved for any file for android, however for iOS images only supported
19 stars 42 forks source link

Image converted but wrong #15

Open marcogrieco opened 7 years ago

marcogrieco commented 7 years ago

Hello, i'm using this plugin but i have a problem. The plugin returns a BASE64 string for an image but if i try to show this image in an img html tag nothing is showed. I have tried also with online tools to show base64 images and i receive this error: "corrupted image".

What i'm wrong?

Thanks.

marcogrieco commented 7 years ago

The plugin doesn't work only on Android. For iOS the base64 is correctly a string of an image. On Android i receive a string but is not an image.

Any suggestion?

allys00 commented 6 years ago

let variavel = this.sanitizer.bypassSecurityTrustResourceUrl(base64File) Retorna URL valida para colocar na view

Nayan014 commented 4 years ago

Remove \n from base64 data after that it will work

base64.replace(/\n/g, '')