commit b0df3af801ecedd2b2a9a8f8e7b952acbc120c64 parent 8858f7eb11ec511fd9998226373cec3b6e3c6eca Author: MTRNord <mtrnord1@gmail.com> Date: Fri, 21 Jan 2022 21:36:55 +0100 Fix image max height Diffstat:
| M | helpers/matrix_client.ts | | | 5 | +---- |
| M | pages/post/[id].tsx | | | 4 | ++-- |
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/helpers/matrix_client.ts b/helpers/matrix_client.ts @@ -267,10 +267,7 @@ export default class MatrixClient { if (mxcUri.indexOf("mxc://") !== 0) { return; } - return `${constMatrixArtServer}/_matrix/media/r0/thumbnail/${mxcUri.split("mxc://")[1] - }?method=${encodeURIComponent(method)}&width=${encodeURIComponent( - width - )}&height=${encodeURIComponent(height)}`; + return `${constMatrixArtServer}/_matrix/media/r0/thumbnail/${mxcUri.split("mxc://")[1]}?method=${encodeURIComponent(method)}&width=${encodeURIComponent(width)}&height=${encodeURIComponent(height)}`; } async uploadFile(file: File): Promise<string> { diff --git a/pages/post/[id].tsx b/pages/post/[id].tsx @@ -281,10 +281,10 @@ class Post extends PureComponent<Props, State> { width="100%" height="" /> - <img loading="eager" width={imageEvent.content['m.image'].width} height={imageEvent.content['m.image'].height} alt={caption} title={caption} className="h-auto w-full relative -ml-[100%] object-cover align-bottom" src={thumbnail_url} /> + <img loading="eager" width={imageEvent.content['m.image'].width - 1} height={imageEvent.content['m.image'].height - 1} alt={caption} title={caption} className="h-auto w-full relative -ml-[100%] object-cover align-bottom max-h-[54.25rem]" src={thumbnail_url} /> </div> ) : ( - <img loading="eager" width={imageEvent.content['m.image'].width} height={imageEvent.content['m.image'].height} className="h-auto w-full" alt={caption} title={caption} src={thumbnail_url} /> + <img loading="eager" width={imageEvent.content['m.image'].width - 1} height={imageEvent.content['m.image'].height - 1} className="h-auto w-full max-h-[54.25rem]" alt={caption} title={caption} src={thumbnail_url} /> ); return ( <>