mirror of
https://github.com/versia-pub/server.git
synced 2026-01-26 12:16:01 +01:00
Check for width and height before making blurhash
This commit is contained in:
parent
bf169623c9
commit
b91eb110cc
|
|
@ -77,15 +77,16 @@ export default apiRoute<{
|
|||
? await sharp(await file.arrayBuffer()).metadata()
|
||||
: null;
|
||||
|
||||
const blurhash = isImage
|
||||
? encode(
|
||||
new Uint8ClampedArray(await file.arrayBuffer()),
|
||||
metadata?.width ?? 0,
|
||||
metadata?.height ?? 0,
|
||||
4,
|
||||
4,
|
||||
)
|
||||
: null;
|
||||
const blurhash =
|
||||
isImage && metadata?.width && metadata?.height
|
||||
? encode(
|
||||
new Uint8ClampedArray(await file.arrayBuffer()),
|
||||
metadata?.width ?? 0,
|
||||
metadata?.height ?? 0,
|
||||
4,
|
||||
4,
|
||||
)
|
||||
: null;
|
||||
|
||||
let url = "";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue