Skip to content

Commit a47de82

Browse files
author
Tino Mettler
committed
Show progress during thumbnail export
1 parent 7f00cb8 commit a47de82

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

contrib/website_gallery_export.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ function escape_js_string(str)
7474
end
7575

7676
local function export_thumbnail(image, filename)
77-
dt.print("export thumbnail image "..filename)
7877
exporter = dt.new_format("jpeg")
7978
exporter.quality = 90
8079
exporter.max_height = 512
@@ -108,14 +107,21 @@ function exiftool_get_image_dimensions(filename)
108107
end
109108
end
110109

110+
local function stop_job(job)
111+
job.valid = false
112+
end
113+
111114
local function fill_gallery_table(images_ordered, images_table, title, dest_dir, sizes, exiftool)
112115
dest_dir = dest_dir.."/images"
113116
local gallery_data = { name = escape_js_string(title) }
114117

115118
local images = {}
116119
local index = 1
120+
local job = dt.gui.create_job("exporting thumbnail images", true, stop_job)
121+
117122
for i, image in pairs(images_ordered) do
118123
local filename = images_table[image]
124+
dt.print("exporting thumbnail image "..index.."/"..#images_ordered)
119125
write_image(image, dest_dir, filename)
120126

121127
if exiftool then
@@ -129,9 +135,11 @@ local function fill_gallery_table(images_ordered, images_table, title, dest_dir,
129135
width = width, height = height }
130136

131137
images[index] = entry
138+
job.percent = index / #images_ordered
132139
index = index + 1
133140
end
134141

142+
stop_job(job)
135143
gallery_data.images = images
136144
return gallery_data
137145
end
@@ -175,7 +183,7 @@ local function copy_static_files(dest_dir)
175183
"index.html",
176184
"gallery.css",
177185
"modal.css",
178-
"modal.js",
186+
"modal.js",
179187
"gallery.js",
180188
"fullscreen.js"
181189
}

0 commit comments

Comments
 (0)