Skip to content

Commit

Permalink
[FIX] Gif images aspect ratio on preview (#20654)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoevanp authored Feb 9, 2021
1 parent ae6af13 commit 374281c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/file-upload/server/lib/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const FileUpload = {
},

uploadsOnValidate(file) {
if (!/^image\/((x-windows-)?bmp|p?jpeg|png)$/.test(file.type)) {
if (!/^image\/((x-windows-)?bmp|p?jpeg|png|gif)$/.test(file.type)) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions client/components/Message/Attachments/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ const getDimensions = (width: Dimensions['width'], height: Dimensions['height'],
const ratio = height / width;

if (height >= width || Math.min(width, limits.width) * ratio > limits.height) {
return { width: width * Math.min(height, limits.height) / height, height: Math.min(height, limits.height) };
return { width: width * Math.min(height, limits.height) / height, height: 'auto' };
}

return { width: Math.min(width, limits.width), height: height * Math.min(width, limits.width) / width };
return { width: Math.min(width, limits.width), height: 'auto' };
};

const Image: FC<ImageProps> = ({ previewUrl, loadImage = true, setLoadImage, src, ...size }) => {
Expand Down

0 comments on commit 374281c

Please sign in to comment.