fix(api): small images height strech fix
This commit is contained in:
parent
002bd2e6f7
commit
90c72f7ffe
1 changed files with 2 additions and 8 deletions
|
@ -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 (
|
||||
|
|
Loading…
Reference in a new issue