Update image-media.ts (#9276)

This commit is contained in:
Michael Telatynski 2022-09-14 12:00:54 +01:00 committed by GitHub
parent 4623d84dd0
commit eace4d6894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,7 @@ export async function createThumbnail(
context.drawImage(element, 0, 0, targetWidth, targetHeight);
let thumbnailPromise: Promise<Blob>;
if (canvas instanceof window.OffscreenCanvas) {
if (window.OffscreenCanvas && canvas instanceof window.OffscreenCanvas) {
thumbnailPromise = canvas.convertToBlob({ type: mimeType });
} else {
thumbnailPromise = new Promise<Blob>(resolve => (canvas as HTMLCanvasElement).toBlob(resolve, mimeType));