- image thumbnail fix in s3

- svg thumbnail fix
This commit is contained in:
Čarodej
2022-04-04 12:58:07 +02:00
parent a3805b4bff
commit c1f775975d
5 changed files with 65 additions and 11 deletions

View File

@@ -23,7 +23,7 @@
<div class="flex h-full w-full items-center justify-center">
<Audio v-if="isAudio" :file="currentFile" />
<Video v-if="isVideo" :file="currentFile" class="mx-auto max-h-full max-w-[1080px] self-center" />
<ImageFile v-if="isImage" :file="currentFile" class="mx-auto max-h-[100%] max-w-[100%] self-center" />
<ImageFile v-if="isImage" :file="currentFile" class="mx-auto max-h-[100%] max-w-[100%] self-center" :class="{'file-shadow': !$isMobile()}" id="printable-file" />
</div>
</div>

View File

@@ -1,11 +1,13 @@
<template>
<img id="printable-file" class="file" :class="{'file-shadow': !$isMobile()}" :src="src" @error="replaceByOriginal" />
<img class="file" :src="src" @error="replaceByOriginal" alt="" />
</template>
<script>
export default {
name: 'ImageFile',
props: ['file'],
props: [
'file'
],
watch: {
'file': function () {
this.getSrc()
@@ -21,9 +23,9 @@ export default {
this.src = this.file.data.attributes.file_url
},
getSrc() {
let windowWidth = window.innerWidth
if (windowWidth > 1280) {
if (this.file.data.attributes.mimetype === 'svg') {
this.src = this.file.data.attributes.file_url
} else if (window.innerWidth > 1280) {
this.src = this.file.data.attributes.thumbnail.xl
} else {
this.src = this.file.data.attributes.thumbnail.lg