1.0.5 • Published 7 years ago

ipfs-image-web-upload v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

ipfs-image-web-upload

Simple uploader/downloader for images stored on ipfs.

Allows to upload pictures from html <input type='file' ...> and use them in <img src='...'> tag.

Usage

To upload image from file input:

<input type='file' id='someFileInputId'>
var uploader = new IPFSUploader(new IPFS());
var file_input = document.getElementById("someFileInputId");
var hash = await uploader.uploadBlob(e.target.files[0]);

To set image to html img element:

<img id='output'>
var img_tag = document.querySelector( "#output" );
uploader.loadImage(img_tag, hash);