refactor: store thumbhash as stirng

This commit is contained in:
2023-08-11 17:33:06 +02:00
parent 0f3f64d118
commit d4db8430e4
2 changed files with 5 additions and 5 deletions

7
lib/cache/image.ts vendored
View File

@ -54,7 +54,9 @@ export function createThumbhash(
);
if (!bytes) return;
const hash = generateThumbhash(bytes, _image.width, _image.height);
if (hash) {
const b64 = btoa(String.fromCharCode(...hash));
cache.set(
getCacheKey({
url,
@ -62,9 +64,9 @@ export function createThumbhash(
width: _image.width,
height: _image.height,
}),
hash,
b64,
);
res(hash);
res(b64);
}
});
});
@ -96,7 +98,6 @@ export function getThumbhash({ url }: { url: string }) {
width: 200,
height: 200,
}),
true,
);
}