Is it possible to save an image in a local storage?


I was wondering if it is possible if I can save an image in a local storage on playcanvas?

As far as I know, localStorage can only store string.
So, choice one of two options.

  1. Using Server - Returns the saved image that matches user info if requested.
  2. Using FileReader - I think this is the way you’re using it.

After all, if you don’t use the server, you have to ask the user.

1 Like

Hi @Connor_Briggs,

You could save it to the local storage by converting it to a base64 string:

3 Likes

Oh, there’s a way to use base64.
Thanks for your good reply. :grinning:

2 Likes

Thank you @Leonidas!

1 Like