From dfeff73fcd7c4b7e8b392af57762c7e0ff4c38a1 Mon Sep 17 00:00:00 2001 From: Tino Mettler Date: Thu, 4 Dec 2025 11:47:36 +0100 Subject: [PATCH] Add callback to check if export format is supported Currently JPG, TIFF, PNG and WebP are supported. --- contrib/website_gallery_export.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/contrib/website_gallery_export.lua b/contrib/website_gallery_export.lua index f05f949..56237f6 100644 --- a/contrib/website_gallery_export.lua +++ b/contrib/website_gallery_export.lua @@ -256,6 +256,22 @@ local function initialize(storage, img_format, images, high_quality, extra_data) extra_data["sizes"] = {}; end -dt.register_storage("module_webgallery", "website gallery (new)", show_status, build_gallery, nil, initialize, gallery_widget) +local supported_formats = { "jpg", "tif", "png", "webp" } + +local formats_lut = {} +for key,format in pairs(supported_formats) do + formats_lut[format] = true +end + +function check_supported(storage, format) + extension = format.extension + if formats_lut[extension] == true then + return true + else + return false + end +end + +dt.register_storage("module_webgallery", "website gallery (new)", show_status, build_gallery, check_supported, initialize, gallery_widget) return script_data