|
|
@ -27,6 +27,7 @@ export class FileGridEntryComponent implements OnInit, OnDestroy {
|
|
|
|
selectedThumbnail: Thumbnail | undefined;
|
|
|
|
selectedThumbnail: Thumbnail | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
contentUrl: SafeResourceUrl | undefined;
|
|
|
|
contentUrl: SafeResourceUrl | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private fileService: FileService, private errorBroker: ErrorBrokerService) { }
|
|
|
|
constructor(private fileService: FileService, private errorBroker: ErrorBrokerService) { }
|
|
|
|
|
|
|
|
|
|
|
|
async ngOnInit() {
|
|
|
|
async ngOnInit() {
|
|
|
@ -37,21 +38,20 @@ export class FileGridEntryComponent implements OnInit, OnDestroy {
|
|
|
|
if (this.contentUrl) {
|
|
|
|
if (this.contentUrl) {
|
|
|
|
const url = this.contentUrl;
|
|
|
|
const url = this.contentUrl;
|
|
|
|
this.contentUrl = undefined;
|
|
|
|
this.contentUrl = undefined;
|
|
|
|
URL?.revokeObjectURL(url as string);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async loadImage() {
|
|
|
|
async loadImage() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const thumbnails = await this.fileService.getThumbnails(this.gridEntry.file.hash);
|
|
|
|
const thumbnails = await this.fileService.getThumbnails(this.gridEntry.file.hash);
|
|
|
|
let thumbnail = thumbnails.find(t => (t.height > 250 || t.width > 250) && (t.height < 500 && t.width < 500));
|
|
|
|
let thumbnail = thumbnails.find(t => (t.height > 250 || t.width > 250) && (t.height < 500 && t.width < 500));
|
|
|
|
this.selectedThumbnail = thumbnail;
|
|
|
|
this.selectedThumbnail = thumbnail;
|
|
|
|
|
|
|
|
|
|
|
|
if (!thumbnail) {
|
|
|
|
if (!thumbnail) {
|
|
|
|
console.log("Thumbnail is empty?!", thumbnails);
|
|
|
|
console.log("Thumbnail is empty?!", thumbnails);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.contentUrl = await this.fileService.readThumbnail(thumbnail!!);
|
|
|
|
this.contentUrl = await this.fileService.readThumbnail(thumbnail!!);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
} catch (err) {
|
|
|
|
this.errorBroker.showError(err);
|
|
|
|
this.errorBroker.showError(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|