diff --git a/contrib/website_gallery_export.lua b/contrib/website_gallery_export.lua index fe83789..f485f0b 100644 --- a/contrib/website_gallery_export.lua +++ b/contrib/website_gallery_export.lua @@ -86,8 +86,8 @@ local function export_thumbnail(image, filename) end local function write_image(image, dest_dir, filename) - df.file_move(filename, dest_dir.."/"..get_file_name(filename)) - export_thumbnail(image, dest_dir.."/thumb_"..get_file_name(filename)) + df.file_move(filename, dest_dir.."/images/"..get_file_name(filename)) + export_thumbnail(image, dest_dir.."/thumbnails/thumb_"..get_file_name(filename)) end function exiftool_get_image_dimensions(filename) @@ -116,7 +116,6 @@ local function stop_job(job) 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 = {} @@ -129,7 +128,7 @@ local function fill_gallery_table(images_ordered, images_table, title, dest_dir, write_image(image, dest_dir, filename) if exiftool then - width, height = exiftool_get_image_dimensions(dest_dir.."/"..get_file_name(filename)) + width, height = exiftool_get_image_dimensions(dest_dir.."/images/"..get_file_name(filename)) else width = sizes[index].width height = sizes[index].height @@ -171,7 +170,7 @@ local function write_javascript_file(gallery_table, dest_dir) dt.print(_("write JavaScript file")) javascript_object = generate_javascript_gallery_object(gallery_table) - local fileOut, errr = io.open(dest_dir.."/images.js", 'w+') + local fileOut, errr = io.open(dest_dir.."/js/images.js", 'w+') if fileOut then fileOut:write(javascript_object) else @@ -181,17 +180,17 @@ local function write_javascript_file(gallery_table, dest_dir) end local function copy_static_files(dest_dir) - dt.print(_("copy static gallery files")) gfsrc = dt.configuration.config_dir.."/lua/data/website_gallery" - gfiles = { + local gfiles = { "index.html", - "gallery.css", - "modal.css", - "modal.js", - "gallery.js", - "fullscreen.js" + "css/gallery.css", + "css/modal.css", + "js/gallery.js", + "js/modal.js", + "js/fullscreen.js" } + dt.print(_("copy static gallery files")) for _, file in ipairs(gfiles) do df.file_copy(gfsrc.."/"..file, dest_dir.."/"..file) end @@ -201,6 +200,9 @@ local function build_gallery(storage, images_table, extra_data) local dest_dir = dest_dir_widget.value df.mkdir(dest_dir) df.mkdir(dest_dir.."/images") + df.mkdir(dest_dir.."/thumbnails") + df.mkdir(dest_dir.."/css") + df.mkdir(dest_dir.."/js") local images_ordered = extra_data["images"] -- process images in the correct order local sizes = extra_data["sizes"] diff --git a/data/website_gallery/gallery.css b/data/website_gallery/css/gallery.css similarity index 100% rename from data/website_gallery/gallery.css rename to data/website_gallery/css/gallery.css diff --git a/data/website_gallery/modal.css b/data/website_gallery/css/modal.css similarity index 100% rename from data/website_gallery/modal.css rename to data/website_gallery/css/modal.css diff --git a/data/website_gallery/index.html b/data/website_gallery/index.html index e9ea614..8abf888 100644 --- a/data/website_gallery/index.html +++ b/data/website_gallery/index.html @@ -4,8 +4,8 @@ - - + + Image Gallery @@ -37,9 +37,9 @@ - - - - + + + + \ No newline at end of file diff --git a/data/website_gallery/fullscreen.js b/data/website_gallery/js/fullscreen.js similarity index 100% rename from data/website_gallery/fullscreen.js rename to data/website_gallery/js/fullscreen.js diff --git a/data/website_gallery/gallery.js b/data/website_gallery/js/gallery.js similarity index 97% rename from data/website_gallery/gallery.js rename to data/website_gallery/js/gallery.js index 54b0c87..be9a8ed 100644 --- a/data/website_gallery/gallery.js +++ b/data/website_gallery/js/gallery.js @@ -66,7 +66,7 @@ document.addEventListener('DOMContentLoaded', function () { const img = document.createElement('img'); img.className = 'thumb'; - img.src = imageObj.filename.replace(/images\/(.*)$/i, 'images/thumb_$1'); + img.src = imageObj.filename.replace(/images\/(.*)$/i, 'thumbnails/thumb_$1'); img.alt = imageObj.filename; img.addEventListener('click', function (e) { e.stopPropagation(); showModal(e); }); diff --git a/data/website_gallery/modal.js b/data/website_gallery/js/modal.js similarity index 100% rename from data/website_gallery/modal.js rename to data/website_gallery/js/modal.js