ipfs-image-web-upload
v1.0.5
Published
Simple uploader/downloader for images stored on ipfs. Allows to upload pictures from html <input type="file" ...> and use them in <img src="..."> tag".
Downloads
14
Maintainers
Readme
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);