Answers for "base64 to image angular"

1

converting an image to base64 in angular

// works like charm in pdfMake and angular
//You can use this function to create generate a base64 image

        toDataURL = async (url) => {
        console.log("Downloading image...");
        var res = await fetch(url);
        var blob = await res.blob();
    
        const result = await new Promise((resolve, reject) => {
          var reader = new FileReader();
          reader.addEventListener("load", function () {
            resolve(reader.result);
          }, false);
    
          reader.onerror = () => {
            return reject(this);
          };
          reader.readAsDataURL(blob);
        })
    
        return result
      };

// and then call it like this

    imageSrcString = await this.toDataURL(imageSrc)
Posted by: Guest on September-17-2021
-1

base64 to image angular

this.imagePath = this._sanitizer.bypassSecurityTrustResourceUrl('data:image/jpg;base64,' 
                 + toReturnImage.base64string);
Posted by: Guest on September-12-2021
-1

base64 to image angular

import { DomSanitizer } from '@angular/platform-browser';
Posted by: Guest on September-12-2021
-1

base64 to image angular

constructor(private _sanitizer: DomSanitizer) { }
Posted by: Guest on September-12-2021
-1

base64 to image angular

<img [src]="imagePath">
Posted by: Guest on September-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language