Fix thumbnail editing, add blobtodataurl method
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user