Cordova Image Picker convert to base64

Previously I had written a post regarding how to Accessing Image Gallery using Ionic and ngCordova plugin in an Ionic Framework application.  This previous post was continue to converting an image to base64 format that has been selected using the ngCordova imagePicker.


This object provides a way to obtain root file systems. Retrieve a DirectoryEntry or FileEntry using local URI. (Function)


At this point, you should have everything set up and ready, we can start working on our example. If you’re using Cordova 4+ you will need to check if there’s a Whitelist plugin installed with your project. If you have it, add this security meta tag img-src * 'self' data: https:;  to your index.html HEAD content:

Without it your application will throw an error during the app initialization, after that it will constantly throwing no security meta-tag found. While not a blocking point, constant console log warnings will make it hard to do any debugging.


ngCordova imagePicker returns an URI not the image data. Here’s the code that should do what you want:


Application main page.


image picker - ngCordova


Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.