mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
- image thumbnail fix in s3
- svg thumbnail fix
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
<div class="flex h-full w-full items-center justify-center">
|
<div class="flex h-full w-full items-center justify-center">
|
||||||
<Audio v-if="isAudio" :file="currentFile" />
|
<Audio v-if="isAudio" :file="currentFile" />
|
||||||
<Video v-if="isVideo" :file="currentFile" class="mx-auto max-h-full max-w-[1080px] self-center" />
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<img id="printable-file" class="file" :class="{'file-shadow': !$isMobile()}" :src="src" @error="replaceByOriginal" />
|
<img class="file" :src="src" @error="replaceByOriginal" alt="" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'ImageFile',
|
name: 'ImageFile',
|
||||||
props: ['file'],
|
props: [
|
||||||
|
'file'
|
||||||
|
],
|
||||||
watch: {
|
watch: {
|
||||||
'file': function () {
|
'file': function () {
|
||||||
this.getSrc()
|
this.getSrc()
|
||||||
@@ -21,9 +23,9 @@ export default {
|
|||||||
this.src = this.file.data.attributes.file_url
|
this.src = this.file.data.attributes.file_url
|
||||||
},
|
},
|
||||||
getSrc() {
|
getSrc() {
|
||||||
let windowWidth = window.innerWidth
|
if (this.file.data.attributes.mimetype === 'svg') {
|
||||||
|
this.src = this.file.data.attributes.file_url
|
||||||
if (windowWidth > 1280) {
|
} else if (window.innerWidth > 1280) {
|
||||||
this.src = this.file.data.attributes.thumbnail.xl
|
this.src = this.file.data.attributes.thumbnail.xl
|
||||||
} else {
|
} else {
|
||||||
this.src = this.file.data.attributes.thumbnail.lg
|
this.src = this.file.data.attributes.thumbnail.lg
|
||||||
|
|||||||
@@ -64,9 +64,10 @@
|
|||||||
|
|
||||||
<img
|
<img
|
||||||
class="h-full w-full rounded-lg object-cover shadow-lg"
|
class="h-full w-full rounded-lg object-cover shadow-lg"
|
||||||
:src="entry.data.attributes.thumbnail.sm"
|
:src="imageSrc"
|
||||||
alt=""
|
alt=""
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
@error="replaceByOriginal"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -157,6 +158,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
mobileMultiSelect: false,
|
mobileMultiSelect: false,
|
||||||
itemName: undefined,
|
itemName: undefined,
|
||||||
|
imageSrc: undefined,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -214,6 +216,14 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageSrc() {
|
||||||
|
this.imageSrc = this.entry.data.attributes.mimetype === 'svg'
|
||||||
|
? this.entry.data.attributes.file_url
|
||||||
|
: this.entry.data.attributes.thumbnail.xs
|
||||||
|
},
|
||||||
|
replaceByOriginal() {
|
||||||
|
this.imageSrc = this.entry.data.attributes.file_url
|
||||||
|
},
|
||||||
showItemActions() {
|
showItemActions() {
|
||||||
this.$store.commit('CLIPBOARD_CLEAR')
|
this.$store.commit('CLIPBOARD_CLEAR')
|
||||||
this.$store.commit('ADD_ITEM_TO_CLIPBOARD', this.entry)
|
this.$store.commit('ADD_ITEM_TO_CLIPBOARD', this.entry)
|
||||||
@@ -248,6 +258,8 @@ export default {
|
|||||||
document.execCommand('selectAll')
|
document.execCommand('selectAll')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.getImageSrc()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -43,9 +43,10 @@
|
|||||||
<img
|
<img
|
||||||
v-if="isImage && entry.data.attributes.thumbnail"
|
v-if="isImage && entry.data.attributes.thumbnail"
|
||||||
class="ml-0.5 h-12 w-12 rounded object-cover"
|
class="ml-0.5 h-12 w-12 rounded object-cover"
|
||||||
:src="entry.data.attributes.thumbnail.xs"
|
:src="imageSrc"
|
||||||
alt=""
|
alt=""
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
@error="replaceByOriginal"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -140,7 +141,8 @@ export default {
|
|||||||
itemName: undefined,
|
itemName: undefined,
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
isChecked: false,
|
isChecked: false,
|
||||||
}
|
imageSrc: undefined,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['isMultiSelectMode', 'clipboard', 'user']),
|
...mapGetters(['isMultiSelectMode', 'clipboard', 'user']),
|
||||||
@@ -190,6 +192,14 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageSrc() {
|
||||||
|
this.imageSrc = this.entry.data.attributes.mimetype === 'svg'
|
||||||
|
? this.entry.data.attributes.file_url
|
||||||
|
: this.entry.data.attributes.thumbnail.xs
|
||||||
|
},
|
||||||
|
replaceByOriginal() {
|
||||||
|
this.imageSrc = this.entry.data.attributes.file_url
|
||||||
|
},
|
||||||
showItemActions() {
|
showItemActions() {
|
||||||
this.$store.commit('CLIPBOARD_CLEAR')
|
this.$store.commit('CLIPBOARD_CLEAR')
|
||||||
this.$store.commit('ADD_ITEM_TO_CLIPBOARD', this.entry)
|
this.$store.commit('ADD_ITEM_TO_CLIPBOARD', this.entry)
|
||||||
@@ -226,6 +236,8 @@ export default {
|
|||||||
document.execCommand('selectAll')
|
document.execCommand('selectAll')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
|
||||||
|
this.getImageSrc()
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="canBePreview" class="mb-4 block w-full">
|
<div v-if="canBePreview" class="mb-4 block w-full">
|
||||||
<!--Image-->
|
<!--Image-->
|
||||||
<ImageFile v-if="singleFile.data.type === 'image'" :file="singleFile" class="w-full overflow-hidden rounded-lg object-cover shadow-lg" />
|
<img
|
||||||
|
v-if="singleFile.data.type === 'image'"
|
||||||
|
:src="imageSrc"
|
||||||
|
class="w-full overflow-hidden rounded-lg object-cover shadow-lg"
|
||||||
|
@error="replaceByOriginal"
|
||||||
|
alt=""
|
||||||
|
>
|
||||||
|
|
||||||
<!--Audio-->
|
<!--Audio-->
|
||||||
<audio
|
<audio
|
||||||
@@ -51,7 +57,29 @@ export default {
|
|||||||
if (val.data.type === 'video') {
|
if (val.data.type === 'video') {
|
||||||
this.$refs.video.load()
|
this.$refs.video.load()
|
||||||
}
|
}
|
||||||
|
if (val.data.type === 'image') {
|
||||||
|
this.getImageSrc()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
imageSrc: undefined,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
replaceByOriginal() {
|
||||||
|
this.imageSrc = this.singleFile.data.attributes.file_url
|
||||||
|
},
|
||||||
|
getImageSrc() {
|
||||||
|
this.imageSrc = this.singleFile.data.attributes.mimetype === 'svg'
|
||||||
|
? this.singleFile.data.attributes.file_url
|
||||||
|
: this.singleFile.data.attributes.thumbnail.lg
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if (this.singleFile.data.type === 'image')
|
||||||
|
this.getImageSrc()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user