< script type = "text/javascript" > function readURL (res) { if (res) { var reader = new FileReader () ; reader . onload = function (e) { console. log (e . target . result); $( '#blah' ) . attr ( 'src' , e . target . result); } reader . readAsDataURL (res); } } //this is for image preview while uploadding function view (){ const file = document. getElementById ( 'imgInp' ) . files[ 0 ]; console. log (file); //this is image compress imageConversion . compressAccurately (file, 100 ) . then (res => { //The res in the promise is a compressed Blob type (which can b...