From e6243fdd3ee360f65448aaed80a46a204b5eced9 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 2 Nov 2020 06:06:42 +0300 Subject: [PATCH] lots of tweaks... Signed-off-by: Alex A. Naanou --- Viewer/features/filesystem.js | 7 ++++++- Viewer/features/sharp.js | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Viewer/features/filesystem.js b/Viewer/features/filesystem.js index 1e9db051..1f9784f9 100755 --- a/Viewer/features/filesystem.js +++ b/Viewer/features/filesystem.js @@ -55,7 +55,7 @@ var IndexFormatActions = actions.Actions({ config: { 'index-dir': '.ImageGrid', - // XXX should these be 'p' or 'px' (current)... + // XXX should these be 'p' or 'px' (current)??? 'preview-sizes': [ 75, 200, @@ -65,6 +65,11 @@ var IndexFormatActions = actions.Actions({ 1440, 2160, ], + 'preview-sizes-priority': [ + 75, + 200, + 1080, + ], // Supported fields: // $INDEX - index directory name diff --git a/Viewer/features/sharp.js b/Viewer/features/sharp.js index 1c1866a2..13c2cd63 100755 --- a/Viewer/features/sharp.js +++ b/Viewer/features/sharp.js @@ -466,6 +466,14 @@ var SharpActions = actions.Actions({ var loaded = this.ribbons && new Set(this.ribbons.getImageGIDs()) + /*/ XXX set this to tmp for .location.load =='loadImages' + var base_path = that.location.load == 'loadIndex' ? + null + : tmp + /*/ + var base_path + //*/ + return images .mapChunks(function(gid){ return sharp(that.getImagePath(gid)) @@ -485,17 +493,19 @@ var SharpActions = actions.Actions({ img.orientation = o.orientation || 0 img.flipped = o.flipped - /* XXX should generate previews in a temp dir or as data-urls... // if image too large, generate preview(s)... var size_threshold = that.config['preview-generate-threshold'] if(size_threshold + && img.preview == null && Math.max(metadata.width, metadata.height) > size_threshold){ logger && logger.emit('Image too large', gid) - // XXX might be a good idea to only generate - // a single preview... - // XXX - this.makePreviews(gid) } - //*/ + // XXX make this more generic... + // ...if 'loadImages' should create previews in tmp... + that.location.load == 'loadIndex' + && that.makePreviews(gid, + that.config['preview-sizes-priority'] || 1080, + base_path, + logger) } // XXX EXIF -- keep compatible with exiftool... // - dates