mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
Add comment about thumbnailing for GIFs
This commit is contained in:
parent
6ea590cf1f
commit
ef5ac27ddc
1 changed files with 6 additions and 3 deletions
|
@ -197,15 +197,18 @@ export default class MImageBody extends React.Component {
|
|||
// synapse only supports 800x600 thumbnails for now though,
|
||||
// so we'll need to download the original image for this to work
|
||||
// well for now. First, let's try a few cases that let us avoid
|
||||
// downloading the original:
|
||||
// downloading the original, including:
|
||||
// - When displaying a GIF, we always want to thumbnail so that we can
|
||||
// properly respect the user's GIF autoplay setting (which relies on
|
||||
// thumbnailing to produce the static preview image)
|
||||
// - On a low DPI device, always thumbnail to save bandwidth
|
||||
// - If there's no sizing info in the event, default to thumbnail
|
||||
const info = content.info;
|
||||
if (
|
||||
this._isGif() ||
|
||||
pixelRatio === 1.0 ||
|
||||
(!info || !info.w || !info.h || !info.size)
|
||||
) {
|
||||
// always thumbnail. it may look a bit worse, but it'll save bandwidth.
|
||||
// which is probably desirable on a lo-dpi device anyway.
|
||||
return this.context.matrixClient.mxcUrlToHttp(content.url, thumbWidth, thumbHeight);
|
||||
} else {
|
||||
// we should only request thumbnails if the image is bigger than 800x600
|
||||
|
|
Loading…
Reference in a new issue