From a47de82afde1b7cf80b78a3b25fe73cd9b0d8022 Mon Sep 17 00:00:00 2001 From: Tino Mettler Date: Mon, 8 Dec 2025 14:53:58 +0100 Subject: [PATCH] Show progress during thumbnail export --- contrib/website_gallery_export.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/contrib/website_gallery_export.lua b/contrib/website_gallery_export.lua index 866ed55..843efc9 100644 --- a/contrib/website_gallery_export.lua +++ b/contrib/website_gallery_export.lua @@ -74,7 +74,6 @@ function escape_js_string(str) end local function export_thumbnail(image, filename) - dt.print("export thumbnail image "..filename) exporter = dt.new_format("jpeg") exporter.quality = 90 exporter.max_height = 512 @@ -108,14 +107,21 @@ function exiftool_get_image_dimensions(filename) end end +local function stop_job(job) + job.valid = false +end + local function fill_gallery_table(images_ordered, images_table, title, dest_dir, sizes, exiftool) dest_dir = dest_dir.."/images" local gallery_data = { name = escape_js_string(title) } local images = {} local index = 1 + local job = dt.gui.create_job("exporting thumbnail images", true, stop_job) + for i, image in pairs(images_ordered) do local filename = images_table[image] + dt.print("exporting thumbnail image "..index.."/"..#images_ordered) write_image(image, dest_dir, filename) if exiftool then @@ -129,9 +135,11 @@ local function fill_gallery_table(images_ordered, images_table, title, dest_dir, width = width, height = height } images[index] = entry + job.percent = index / #images_ordered index = index + 1 end + stop_job(job) gallery_data.images = images return gallery_data end @@ -175,7 +183,7 @@ local function copy_static_files(dest_dir) "index.html", "gallery.css", "modal.css", - "modal.js", + "modal.js", "gallery.js", "fullscreen.js" }