make attacments the same size that they are displayed on the UI

pull/1884/head
audric 4 years ago
parent 2e9cd0ada6
commit a986931569

@ -202,7 +202,7 @@ exports.save = AttachmentTS.save;
exports.getFileExtension = AttachmentTS.getFileExtension; exports.getFileExtension = AttachmentTS.getFileExtension;
exports.arrayBufferFromFile = AttachmentTS.arrayBufferFromFile; exports.arrayBufferFromFile = AttachmentTS.arrayBufferFromFile;
const THUMBNAIL_SIZE = 150; const THUMBNAIL_SIZE = 200;
const THUMBNAIL_CONTENT_TYPE = 'image/png'; const THUMBNAIL_CONTENT_TYPE = 'image/png';
exports.captureDimensionsAndScreenshot = async ( exports.captureDimensionsAndScreenshot = async (

@ -8,7 +8,6 @@ import {
getAlt, getAlt,
getImageDimensions, getImageDimensions,
getThumbnailUrl, getThumbnailUrl,
getUrl,
isVideoAttachment, isVideoAttachment,
} from '../../types/Attachment'; } from '../../types/Attachment';
@ -44,7 +43,7 @@ export const ImageGrid = (props: Props) => {
playIconOverlay={isVideoAttachment(attachments[0])} playIconOverlay={isVideoAttachment(attachments[0])}
height={height} height={height}
width={width} width={width}
url={getUrl(attachments[0])} url={getThumbnailUrl(attachments[0])}
onClick={onClickAttachment} onClick={onClickAttachment}
onError={onError} onError={onError}
/> />
@ -91,7 +90,7 @@ export const ImageGrid = (props: Props) => {
playIconOverlay={isVideoAttachment(attachments[0])} playIconOverlay={isVideoAttachment(attachments[0])}
height={200} height={200}
width={199} width={199}
url={getUrl(attachments[0])} url={getThumbnailUrl(attachments[0])}
onClick={onClickAttachment} onClick={onClickAttachment}
onError={onError} onError={onError}
/> />

@ -1,5 +1,5 @@
import _, { noop } from 'lodash'; import _, { noop } from 'lodash';
import React, { useCallback } from 'react'; import React, { useCallback, useState } from 'react';
import { InView } from 'react-intersection-observer'; import { InView } from 'react-intersection-observer';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { getMessageById } from '../../data/data'; import { getMessageById } from '../../data/data';

@ -8,10 +8,10 @@ import { SignalService } from '../protobuf';
import { isImageTypeSupported, isVideoTypeSupported } from '../util/GoogleChrome'; import { isImageTypeSupported, isVideoTypeSupported } from '../util/GoogleChrome';
import { fromHexToArray } from '../session/utils/String'; import { fromHexToArray } from '../session/utils/String';
const MAX_WIDTH = 300; const MAX_WIDTH = 200;
const MAX_HEIGHT = MAX_WIDTH * 1.5; const MAX_HEIGHT = MAX_WIDTH;
const MIN_WIDTH = 200; const MIN_WIDTH = MAX_WIDTH;
const MIN_HEIGHT = 50; const MIN_HEIGHT = MAX_WIDTH;
// Used for display // Used for display

Loading…
Cancel
Save