썸네일을 메모리와 OPFS에 캐시하도록 개선

This commit is contained in:
static
2025-07-06 05:36:05 +09:00
parent 3a637b14b4
commit 781642fed6
11 changed files with 88 additions and 32 deletions

View File

@@ -1,3 +1,5 @@
import { encodeToBase64 } from "$lib/modules/crypto";
const scaleSize = (width: number, height: number, targetSize: number) => {
if (width <= targetSize || height <= targetSize) {
return { width, height };
@@ -74,3 +76,7 @@ export const generateVideoThumbnail = (videoUrl: string, time = 0) => {
video.src = videoUrl;
});
};
export const getThumbnailUrl = (thumbnailBuffer: ArrayBuffer) => {
return `data:image/webp;base64,${encodeToBase64(thumbnailBuffer)}`;
};