This commit is contained in:
纳西妲 · Nahida 2025-10-16 16:46:47 +02:00 committed by GitHub
commit f35d43124c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 9 deletions

View file

@ -184,13 +184,32 @@ export function RenderMessageContent({
}
if (msgType === MsgType.Image) {
const content: IImageContent = getContent();
const width = content?.info?.w;
const height = content?.info?.h;
let thumbnail: {
imgWidth: number,
imgHeight: number,
resizeMethod: string
} | undefined;
if (width && height) {
const scale = (width > height ? width : height) / 800;
if (width > 800 || height > 800 && scale > 1) {
thumbnail = {
imgWidth: width / scale,
imgHeight: height / scale,
resizeMethod: "scale",
}
}
}
return (
<>
<MImage
content={getContent()}
content={content}
renderImageContent={(props) => (
<ImageContent
{...props}
{...thumbnail}
autoPlay={mediaAutoLoad}
renderImage={(p) => <Image {...p} loading="lazy" />}
renderViewer={(p) => <ImageViewer {...p} />}