fix: cap image and video attachments to 400x300

This commit is contained in:
Jannis Braun
2026-03-24 05:15:51 +01:00
parent acb79c9de7
commit e64658bdd5
@@ -33,12 +33,12 @@ export function AttachmentRenderer({ attachment }: AttachmentRendererProps) {
return ( return (
<div <div
className="max-w-fit mt-1 rounded-lg overflow-hidden border border-white/[0.06]" className="max-w-fit mt-1 rounded-lg overflow-hidden border border-white/[0.06]"
style={width && height ? { aspectRatio: `${width}/${height}`, maxWidth: Math.min(width, 550), maxHeight: 350 } : undefined} style={width && height ? { aspectRatio: `${width}/${height}`, maxWidth: Math.min(width, 400), maxHeight: 300 } : undefined}
> >
<img <img
src={thumbUrl ?? attUrl} src={thumbUrl ?? attUrl}
alt={originalName} alt={originalName}
className="w-full h-full object-contain cursor-pointer hover:brightness-95 transition-all" className="w-full h-full max-w-[400px] max-h-[300px] object-contain cursor-pointer hover:brightness-95 transition-all"
onClick={() => openImagePreview(attUrl)} onClick={() => openImagePreview(attUrl)}
loading="lazy" loading="lazy"
/> />
@@ -51,8 +51,8 @@ export function AttachmentRenderer({ attachment }: AttachmentRendererProps) {
const hasDimensions = width && height; const hasDimensions = width && height;
return ( return (
<div <div
className="mt-1 max-w-[520px] rounded-lg overflow-hidden" className="mt-1 max-w-[400px] max-h-[300px] rounded-lg overflow-hidden"
style={hasDimensions ? { aspectRatio: `${width}/${height}`, maxHeight: 400 } : undefined} style={hasDimensions ? { aspectRatio: `${width}/${height}`, maxHeight: 300 } : undefined}
> >
<video <video
controls controls