Fix thumbnail editing, add blobtodataurl method
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2021-08-05 16:33:31 +02:00
parent 1daa8e257f
commit eb1157d608
3 changed files with 53 additions and 14 deletions

View File

@@ -48,4 +48,18 @@ export class ImageService {
blobToFile(blob:Blob, filename:string):File {
return new File([blob],filename,{type:blob.type});
}
blobToDataUrl(blob:File):Promise<string> {
return new Promise<string>((resolve) => {
let reader = new FileReader();
reader.addEventListener('error', () => {
resolve("");
});
reader.addEventListener("load", function () {
resolve(reader.result as string);
}, false);
reader.readAsDataURL(blob);
});
}
}