Fix toDataURL is not a function

This commit is contained in:
Lim Chee Aun 2024-08-31 20:12:37 +08:00
parent 550d1beb13
commit bff32b2d68

View file

@ -2659,7 +2659,12 @@ function Card({ card, selfReferential, instance }) {
const imageData = ctx.createImageData(w, h);
imageData.data.set(blurhashPixels);
ctx.putImageData(imageData, 0, 0);
blurhashImage = canvas.toDataURL();
if (window.OffscreenCanvas) {
const blob = canvas.convertToBlob();
blurhashImage = URL.createObjectURL(blob);
} else {
blurhashImage = canvas.toDataURL();
}
}
const isPost = isCardPost(domain);