How to save image in localstorage and display

I found examples , but I think they are only for jquery, let me know if there is any plugin or library to help save an image, and then show

Image from the gallery or from the camera? Have you got a code to obtain that photo, so we need only to tell you how to save it in localstorage?

From my galery, can you show me how??

I edit my post, check again

If the image is not so big ( kb ) you can base64 encode it and save in local storage.

Example:

this.local = new Storage( LocalStorage );
this.local.set( 'propic', btoa( YOUR_IMAGE_CONTENT ) );

This code is for Ionic2 ( Doc: http://ionicframework.com/docs/v2/api/platform/storage/LocalStorage/ )

If your are using Ionic 1.x, maybe you can check here: https://dbwriteups.wordpress.com/2015/09/19/saving-images-to-app-storage-in-ionic-using-ngcordova/

But this example is for iphone, work for android the same way??

Sure. Instead of platform add ios you have to write platform add android

1 Like