-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6529 from owncloud/space-images-as-thumbnails
Load thumbnails for space images instead of the whole file
- Loading branch information
Showing
15 changed files
with
223 additions
and
44 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelog/unreleased/enhancement-load-space-images-as-preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './archiver' | ||
export * from './thumbnail' | ||
export * from './cache' | ||
export { default as Registry } from './registry' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
interface ThumbnailCapability { | ||
enabled: boolean | ||
version: string // version is just a major version, e.g. `v2` | ||
supportedMimeTypes: string[] | ||
} | ||
|
||
export class ThumbnailService { | ||
serverUrl: string | ||
capability?: ThumbnailCapability | ||
|
||
public initialize(thumbnailCapability: ThumbnailCapability = null): void { | ||
this.capability = thumbnailCapability | ||
} | ||
|
||
public get available(): boolean { | ||
return !!this.capability?.version | ||
} | ||
|
||
public isMimetypeSupported(mimeType: string, onlyImages = false) { | ||
return onlyImages | ||
? mimeType.startsWith('image/') && this.capability.supportedMimeTypes.includes(mimeType) | ||
: this.capability.supportedMimeTypes.includes(mimeType) | ||
} | ||
|
||
public getSupportedMimeTypes(filter?: string) { | ||
if (!filter) { | ||
return this.capability.supportedMimeTypes | ||
} | ||
return this.capability.supportedMimeTypes.filter((mimeType) => mimeType.startsWith(filter)) | ||
} | ||
} | ||
|
||
export const thumbnailService = new ThumbnailService() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.