uploading sanitized image file from angular2 to firebase storage
quant-daddy opened this issue · comments
I'm using angular2 DOM sanitizer to read an image file. I want to upload this file to the firebase storage. However, I am unable to find a way to convert the sanitized image to a blob or something that can be uploaded.
I'm using the function to read the image file.
readImage2(inputValue: any): Observable<any> {
var file:File = inputValue.files[0];
return this.ng2ImgMaxService.compress([file], this.maxImageSize).mergeMap( (result) => {
const compressedImage = window.URL.createObjectURL(result);
const compressedImageTrusted=this.sanitizer.bypassSecurityTrustUrl(compressedImage);
return Observable.create((observer) => {
observer.next({imageUrl: compressedImageTrusted});
})
})
}
In this code, I want to upload the compressedImageTrusted file to firebase storage. This file has a type SafeUrlImplwhich I'm not sure how to convert to something that I can upload to a firebase storage. Any help would be appreciated.
I should have raised the issue in angularfire2 repo..