fix(api): small images height strech fix

This commit is contained in:
diced 2021-09-03 16:50:14 -07:00
parent 002bd2e6f7
commit 90c72f7ffe
No known key found for this signature in database
GPG key ID: 85AB64C74535D76E

View file

@ -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 (