From 90c72f7ffe41ddc8ef6bb78b603315a82960c9ba Mon Sep 17 00:00:00 2001 From: diced Date: Fri, 3 Sep 2021 16:50:14 -0700 Subject: [PATCH] fix(api): small images height strech fix --- src/pages/[...id].tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pages/[...id].tsx b/src/pages/[...id].tsx index 3d96cb1..7b62cd0 100644 --- a/src/pages/[...id].tsx +++ b/src/pages/[...id].tsx @@ -14,17 +14,11 @@ export default function EmbeddedImage({ image, title, username, color, normal, e const original = new Image; original.src = dataURL('/r'); - if (original.width > innerWidth) { - imageEl.width = Math.floor(original.width * Math.min((innerHeight / original.height), (innerWidth / original.width))); - imageEl.height = innerHeight; - } else { - imageEl.width = original.width; - imageEl.height = original.height; - } + if (original.width > innerWidth) imageEl.width = Math.floor(original.width * Math.min((innerHeight / original.height), (innerWidth / original.width))); + else imageEl.width = original.width; }; if (typeof window !== 'undefined') window.onresize = () => updateImage(); - useEffect(() => updateImage(), []); return (