<img src="picture_1.png" id="imgHolder"/>
Would like to save image with indexedDB in database named Images on button click.
<button id="write" onclick="saveToDB()">Save To DB</button>
Another button will read image from Images database to display in <div id="resultContent"/>
.
<button id="read" onclick="readFromDB()">Read from DB</button>
General idea is:
indexedDB.open()
for that.objectStore
.XMLHttpRequest
for that.URL.createObjectURL()
functionsrc
attribute in an image
tag.See more: https://hacks.mozilla.org/2012/02/storing-images-and-files-in-indexeddb/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With