From 0101c47a3aea446a3e784e991e947a578b5e3698 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sat, 26 Aug 2023 22:19:45 +0800 Subject: [PATCH] Update thumbnail scale round method --- routes/api/thumbnail/[id].ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/routes/api/thumbnail/[id].ts b/routes/api/thumbnail/[id].ts index 2195466..8779bcd 100644 --- a/routes/api/thumbnail/[id].ts +++ b/routes/api/thumbnail/[id].ts @@ -50,17 +50,17 @@ export const handler: Handlers = { cfg.height = height; } else if (width !== null) { cfg.width = width; - cfg.height = Math.round(f.height / f.width * width); + cfg.height = Math.floor(f.height / f.width * width); } else if (height !== null) { cfg.height = height; - cfg.width = Math.round(f.width / f.height * height); + cfg.width = Math.floor(f.width / f.height * height); } else { if (f.width > f.height) { cfg.width = max; - cfg.height = Math.round(f.height / f.width * max); + cfg.height = Math.floor(f.height / f.width * max); } else { cfg.height = max; - cfg.width = Math.round(f.width / f.height * max); + cfg.width = Math.floor(f.width / f.height * max); } } if (!force) {