Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-url-image-aspect-ratio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed incorrect aspect ratios for URL image previews (e.g., Giphy GIFs) by adding `object-fit: contain` and `width: auto` to the `UrlImagePreview` component, ensuring images scale proportionally within the max-height constraint.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ const UrlImagePreview = ({ url }: Pick<UrlPreviewMetadata, 'url'>): ReactElement
const { maxHeight: oembedMaxHeight } = useOembedLayout();

return (
<Box maxHeight={oembedMaxHeight} maxWidth='100%'>
<MessageGenericPreviewImage data-id={url} className='preview-image' url={url || ''} alt='' />
<Box maxHeight={oembedMaxHeight} maxWidth='100%' overflow='hidden'>
<MessageGenericPreviewImage
data-id={url}
className='preview-image'
url={url || ''}
alt=''
style={{ maxHeight: oembedMaxHeight, width: 'auto', maxWidth: '100%', objectFit: 'contain' }}
/>
</Box>
);
};
Expand Down