Page 1 of 1

How to store images in a local storage variable model to be accessed offline?

Posted: Thu Apr 27, 2017 8:10 am
by Paul Medawar

Hi,

My first page in a app calls a database service and stores the responses in a local storage variable model.

I then want to be able to use the data whilst the device is offline, and the following pages map from the local storage model, with no issues.

The only issue I have is that one column is a file type containing images.

How can I store these images locally (i.e. not just a url string), so that they can be called offline?

thanks


How to store images in a local storage variable model to be accessed offline?

Posted: Thu Apr 27, 2017 9:58 am
by Serhii Kulibaba

Hello Paul,

The localStorage keeps all values as strings, so the only one way to keep images there is base64 format, which is not good, because it has limit 5MB (http://stackoverflow.com/questions/29...)

So it is better to write them locally as files: https://cordova.apache.org/docs/en/la...


How to store images in a local storage variable model to be accessed offline?

Posted: Thu Apr 27, 2017 10:29 am
by Paul Medawar

Ok thank Serhii