Paul Medawar
Posts: 0
Joined: Thu Apr 03, 2014 10:55 am

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

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

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

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...

Return to “Issues”