ngx-image-compress
ngx-image-compress copied to clipboard
uploadAndGetImageWithMaxSize and uploadAndGetImageWithMaxSizeAndMetas always rejected (noticeable in the stackblitz demo, even if the resultant image is smaller than the set 1MB limit)
well... I think I've been too extensive in the title..
Hey so one thing i did to get around this is
const MAX_MEGABYTE = 2; this.imageCompress.uploadFile().then((val) => { let byteCount = this.imageCompress.byteCount(val.image) console.log('here') if(byteCount > (MAX_MEGABYTE *1024*1024)) { this.imageCompress.getImageWithMaxSizeAndMetas(val, MAX_MEGABYTE).then(val =>this.Upload(val), (rejected)=> this.Reject(rejected)) } else{ this.Upload((val)) } }, (rejected)=> this.Reject(rejected))