Skip to content

Commit dfeff73

Browse files
author
Tino Mettler
committed
Add callback to check if export format is supported
Currently JPG, TIFF, PNG and WebP are supported.
1 parent 7f4bae4 commit dfeff73

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

contrib/website_gallery_export.lua

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,22 @@ local function initialize(storage, img_format, images, high_quality, extra_data)
256256
extra_data["sizes"] = {};
257257
end
258258

259-
dt.register_storage("module_webgallery", "website gallery (new)", show_status, build_gallery, nil, initialize, gallery_widget)
259+
local supported_formats = { "jpg", "tif", "png", "webp" }
260+
261+
local formats_lut = {}
262+
for key,format in pairs(supported_formats) do
263+
formats_lut[format] = true
264+
end
265+
266+
function check_supported(storage, format)
267+
extension = format.extension
268+
if formats_lut[extension] == true then
269+
return true
270+
else
271+
return false
272+
end
273+
end
274+
275+
dt.register_storage("module_webgallery", "website gallery (new)", show_status, build_gallery, check_supported, initialize, gallery_widget)
260276

261277
return script_data

0 commit comments

Comments
 (0)