Don't crop GIF and PNG

Work on issue #57
This commit is contained in:
N-Pex 2021-03-04 17:38:07 +01:00
parent 3ac8dd0fc9
commit b7eaaea8e0

View file

@ -7,7 +7,7 @@
}}</span>
</v-avatar>
<div class="bubble image-bubble">
<v-img :aspect-ratio="16 / 9" ref="image" :src="src" cover />
<v-img :aspect-ratio="16 / 9" ref="image" :src="src" :cover="cover" :contain="contain" />
<QuickReactions :event="event" :reactions="reactions" />
</div>
<div class="op-button" ref="opbutton">
@ -33,6 +33,8 @@ export default {
data() {
return {
src: null,
cover: true,
contain: false
};
},
mounted() {
@ -42,6 +44,16 @@ export default {
util
.getThumbnail(this.$matrix.matrixClient, this.event, width, height)
.then((url) => {
const info = this.event.getContent().info;
// JPEGs use cover, PNG and GIF ect contain. This is because PNG and GIF are expected to
// be stickers and small emoji type things.
if (info && info.mimetype && info.mimetype.startsWith("image/jp")) {
this.cover = true;
this.contain = false;
} else {
this.cover = false;
this.contain = true;
}
this.src = url;
})
.catch((err) => {