diff --git a/changelog/unreleased/enhancement-load-space-images-as-preview b/changelog/unreleased/enhancement-load-space-images-as-preview new file mode 100644 index 00000000000..1d80c9cda07 --- /dev/null +++ b/changelog/unreleased/enhancement-load-space-images-as-preview @@ -0,0 +1,5 @@ +Enhancement: Load space images as preview + +We've added a new logic which renders space images as preview to minimize data traffic + +https://github.com/owncloud/web/pull/6529 diff --git a/packages/web-app-files/src/components/SideBar/Actions/SpaceActions.vue b/packages/web-app-files/src/components/SideBar/Actions/SpaceActions.vue index 090f5f31859..8af2921ff43 100644 --- a/packages/web-app-files/src/components/SideBar/Actions/SpaceActions.vue +++ b/packages/web-app-files/src/components/SideBar/Actions/SpaceActions.vue @@ -11,9 +11,8 @@ ref="spaceImageInput" type="file" name="file" - multiple tabindex="-1" - accept="image/*" + :accept="supportedSpaceImageMimeTypes" @change="$_uploadImage_uploadImageSpace" /> @@ -41,6 +40,7 @@ import UploadImage from '../../../mixins/spaces/actions/uploadImage' import EditQuota from '../../../mixins/spaces/actions/editQuota' import QuotaModal from '../../Spaces/QuotaModal.vue' import ReadmeContentModal from '../../../components/Spaces/ReadmeContentModal.vue' +import { thumbnailService } from '../../../services' export default { name: 'SpaceActions', @@ -80,6 +80,9 @@ export default { }, quotaModalIsOpen() { return this.$data.$_editQuota_modalOpen + }, + supportedSpaceImageMimeTypes() { + return thumbnailService.getSupportedMimeTypes('image/').join(',') } }, methods: { diff --git a/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue b/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue index 7c6d177fc70..d868d8b7a76 100644 --- a/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue +++ b/packages/web-app-files/src/components/SideBar/Details/SpaceDetails.vue @@ -3,7 +3,7 @@
- +
mimeType.startsWith(filter)) + } +} + +export const thumbnailService = new ThumbnailService() diff --git a/packages/web-app-files/src/views/spaces/Project.vue b/packages/web-app-files/src/views/spaces/Project.vue index 28563b5a2e9..97c9d49e0d4 100644 --- a/packages/web-app-files/src/views/spaces/Project.vue +++ b/packages/web-app-files/src/views/spaces/Project.vue @@ -16,7 +16,7 @@ :class="{ expanded: imageExpanded }" class="space-overview-image oc-cursor-pointer" alt="" - :src="'data:' + imageContent.mimeType + ';base64,' + imageContent.data" + :src="imageContent" @click="toggleImageExpanded" />
@@ -49,7 +49,7 @@ name="file" multiple tabindex="-1" - accept="image/*" + :accept="supportedSpaceImageMimeTypes" @change="$_uploadImage_uploadImageSpace" />