Y
Y
Yura Komarov2017-07-19 11:07:32
JavaScript
Yura Komarov, 2017-07-19 11:07:32

Is it possible to store an image object in localstorag?

URL.createObjectURL() is a static method that creates a DOMString containing a URL pointing to an object given as a parameter.
Such a question: is it possible to store an image from input type="file" in localstorage as an object for this method in order to reuse this image

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2017-07-19
@Sanasol

https://stackoverflow.com/a/2989317
If you can, but is it worth doing this - definitely not.

R
RidgeA, 2017-07-19
@RidgeA

you can store a string in LocalStorage.
Keeping a link to an image is not a problem.
To save the picture itself, you need to bring it to a string. Narpimer via base64.
But LS is not rubber

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question