2

Question..

Is it possible to store an image in localstorage (or any browser based storage mechanism) without converting it to Base64 and referencing this image in HTML as path (not as inline data)?

The reason..

I am working with a WYSIWYG editor that can display Base64 images (in it's contenteditable div).

It works.. But it degrades performance a bunch. The data string inlined in the HTML img src chokes the WYSIWYG performance, whereas an img tag with a path string as src would not cause this issue.

For reasons I won't get into, I have the requirement to store the images locally and only locally.

Other solutions?..
Localstorage AFAIK is limited to storing serialized data (strings) so my guess is this is a dead end. But perhaps there any other solutions?

Edit
I do not need to upload images to server. This app will be entirely offline.The app will store data (JSON and images) locally only.

GN.
  • 8,672
  • 10
  • 61
  • 126
  • You really cannot, AFAIK, and I see `offline` tagged but that doesn't mean you can upload the image to your server, and update its value (in a session, perhaps) – Adam Azad Aug 05 '16 at 20:20
  • I've updated my question, hopefully I've clarified my usecase. Uploading is not necessary. – GN. Aug 05 '16 at 20:28
  • 3
    Take a look at [converting base64 to blob](http://stackoverflow.com/a/16245768/2151050). [Browser support (just in case you care about IE)](http://caniuse.com/blob) – Adam Azad Aug 05 '16 at 20:30

0 Answers0