Added HEIC, HEIF and HIF support v0.6
This commit is contained in:
1 parent
3acf6bb7ec
commit
47b8d42295
9 files changed
+83
-32
No files matched your search
+7
-4
@@ -118,11 +118,12 @@ function formatType(filename) {
|
||||
if (extension === 'jpg' || extension === 'jpeg') return 'JPG';
|
||||
if (extension === 'png') return 'PNG';
|
||||
if (extension === 'tif' || extension === 'tiff') return 'TIFF';
|
||||
if (extension === 'heic' || extension === 'heif' || extension === 'hif') return 'HEIF';
|
||||
return extension.toUpperCase();
|
||||
}
|
||||
|
||||
function requiresServerPreview(photo) {
|
||||
return photo.format === 'TIFF';
|
||||
return photo.format === 'TIFF' || photo.format === 'HEIF';
|
||||
}
|
||||
|
||||
function storageKey() {
|
||||
@@ -176,7 +177,7 @@ async function scanFolder() {
|
||||
const photos = [];
|
||||
|
||||
for await (const [name, handle] of state.directoryHandle.entries()) {
|
||||
if (handle.kind !== 'file' || !/\.(jpe?g|png|tiff?)$/i.test(name)) continue;
|
||||
if (handle.kind !== 'file' || !/\.(jpe?g|png|tiff?|heic|heif|hif)$/i.test(name)) continue;
|
||||
const file = await handle.getFile();
|
||||
const previous = stored.photos?.[name] || {};
|
||||
const unchanged = !previous.lastModified || previous.lastModified === file.lastModified;
|
||||
@@ -215,7 +216,7 @@ async function scanFolder() {
|
||||
} else {
|
||||
elements.viewerContent.classList.add('hidden');
|
||||
elements.viewerEmpty.classList.remove('hidden');
|
||||
showToast('No JPG, PNG, or TIFF files were found in that folder.', true);
|
||||
showToast('No JPG, PNG, TIFF, HEIC, HEIF, or HIF files were found in that folder.', true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +399,9 @@ async function selectPhoto(index, force = false) {
|
||||
active?.scrollIntoView({ block: 'nearest' });
|
||||
|
||||
try {
|
||||
if (requiresServerPreview(photo)) setSaveStatus('loading', 'Rendering TIFF preview…', photo.name);
|
||||
if (requiresServerPreview(photo)) {
|
||||
setSaveStatus('loading', `Rendering ${photo.format} preview…`, photo.name);
|
||||
}
|
||||
const previewUrl = await getPreviewUrl(photo, file);
|
||||
if (selectionToken !== state.selectionToken || state.currentIndex !== index) return;
|
||||
elements.preview.src = previewUrl;
|
||||
|
||||
Reference in new issue
Block a user