refactor: store thumbhash as stirng
This commit is contained in:
7
lib/cache/image.ts
vendored
7
lib/cache/image.ts
vendored
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user