diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef60ee0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +pictures/lab/storage_2024_03_07/.tmp/* +pictures/radioburzy/2024_leden/.tmp/* + +!.gitignore +!.nojekyll +!.github \ No newline at end of file diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ + diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..4842fe9 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +zap.devvie.cc \ No newline at end of file diff --git a/assets/script.js b/assets/script.js new file mode 100644 index 0000000..177279a --- /dev/null +++ b/assets/script.js @@ -0,0 +1,96 @@ +var current_image_index = 0; +var image_paths = [ + {{image_paths}} +]; + +function open_image_viewer(image_path) { + current_image_index = image_paths.indexOf(image_path); + update_image_viewer(); + document.querySelector(".image-viewer").style.display = "flex"; + document.body.style.overflow = "hidden"; + + document.addEventListener("keydown", handle_keypress); + + // Add event listener for mouse wheel + document.querySelector(".gallery").addEventListener("wheel", function(event) { + if (event.deltaY < 0) { + // Scrolling up + navigate_image(event, -1); + } else { + // Scrolling down + navigate_image(event, 1); + } + }); +} + +function close_image_viewer() { + var img = document.getElementById("viewer-image"); + img.style.transform = "scale(1)"; + document.querySelector(".image-viewer").style.display = "none"; + document.body.style.overflow = "auto"; + + document.removeEventListener("keydown", handle_keypress); + document.querySelector(".gallery").removeEventListener("wheel", handle_wheel); +} + +function navigate_image(event, direction) { + var img = document.getElementById("viewer-image"); + img.style.transform = "scale(1)"; + event.stopPropagation(); + current_image_index += direction; + if (current_image_index < 0) { + current_image_index = image_paths.length - 1; + } else if (current_image_index >= image_paths.length) { + current_image_index = 0; + } + update_image_viewer(); +} + +function update_image_viewer() { + document.getElementById("viewer-image").src = image_paths[current_image_index]; +} + +function toggle_dark_mode() { + var body = document.body; + body.classList.toggle("dark-mode"); +} + +function zoom_image(event) { + var img = document.getElementById("viewer-image"); + var bounding_rect = img.getBoundingClientRect(); + + var x = (event.clientX - bounding_rect.left) / bounding_rect.width; + var y = (event.clientY - bounding_rect.top) / bounding_rect.height; + + img.style.transformOrigin = `${x * 100}% ${y * 100}%`; + img.style.transform = img.style.transform === "scale(2)" ? "scale(1)" : "scale(2)"; + + event.stopPropagation(); +} + +function handle_keypress(event) { + if (document.querySelector(".image-viewer").style.display === "flex") { + switch(event.key) { + case "ArrowLeft": + navigate_image(event, -1); + break; + case "ArrowRight": + navigate_image(event, 1); + break; + case "Escape": + close_image_viewer(); + break; + } + } +} + +window.addEventListener("scroll", function () { + var body = document.body; + var scroll_position = window.scrollY; + + if (scroll_position > 0) { + body.classList.add("scrolled"); + } else { + body.classList.remove("scrolled"); + } +}); diff --git a/assets/style.css b/assets/style.css new file mode 100644 index 0000000..6225022 --- /dev/null +++ b/assets/style.css @@ -0,0 +1,180 @@ +body { + margin: 0; + font-family: Arial, sans-serif; +} + +.header-box { + background-color: #333; + color: white; + padding: 15px; + text-align: center; + position: fixed; + width: 100%; + top: 0; + transition: top 0.3s; + z-index: 1; + display: flex; + justify-content: space-between; +} + +.header-box h1 { + margin: 0; +} + +.header-box button { + background-color: #4CAF50; + color: white; + padding: 10px 20px; + border: none; + border-radius: 5px; + cursor: pointer; + margin-left: auto; + margin-right: 30px; +} + +.github-link { + position: fixed; + bottom: 0; + right: 0; + display: flex; + align-items: center; + margin-left: auto; + margin-right: 5px; + margin-bottom: 5px; + margin-top: auto; +} + +.github-link img { + width: 40px; + margin-right: 5px; +} + +.content { + padding: 80px 16px; +} + +body.scrolled .header-box { + top: -100px; +} + +.gallery { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 10px; +} +img { + max-width: 100%; + max-height: 400px; + height: auto; + border: 2px solid #ddd; + border-radius: 8px; + transition: 0.3s; + cursor: pointer; +} +img:hover { + border: 2px solid #777; + transition: transform 0.3s ease-out; +} +.image-viewer { + z-index: 3; + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.8); + justify-content: center; + align-items: center; +} + +.image-viewer img { + max-width: 90%; + max-height: 90%; + cursor: zoom-in; /* add cursor style for zooming in */ + transition: transform 0.5s ease-out; +} +.close-btn { + font-size: 40px; + color: white; + cursor: pointer; + position: absolute; + top: 10px; + right: 20px; + z-index: 1; +} +.nav-arrows { + position: fixed; + top: 50%; + display: flex; + justify-content: space-between; + width: 100%; + padding: 0 20px; + z-index: 1; +} + +.nav-arrow { + font-size: 60px; + color: white; + cursor: pointer; + padding: 20px; + position: relative; +} + +.nav-arrow-left { + margin-left: 20px; +} + +.nav-arrow-right { + margin-right: 20px; +} + +.nav-arrow-left:before, +.nav-arrow-right:before { + content: ''; + position: absolute; + top: -20px; + right: -20px; + bottom: -20px; + left: -20px; +} + +.dark-mode-btn { + top: 10px; + right: 10px; + cursor: pointer; + font-size: 18px; + padding: 5px; + background-color: #333; + color: #fff; + border: none; + border-radius: 5px; + transition: background-color 0.3s ease, color 0.3s ease; +} + +body.dark-mode { + background-color: #2a2a2a; + color: #fff; +} + +body.dark-mode .header-box { + background-color: #111; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); +} + +body.dark-mode .header-box h1 { + color: #fff; +} + +body.dark-mode * { + border-color: #333; +} + +body.dark-mode .content { + background-color: #2a2a2a; +} + +.viewed-image { + z-index: 2; +} diff --git a/assets/template.html b/assets/template.html new file mode 100644 index 0000000..ee3f75b --- /dev/null +++ b/assets/template.html @@ -0,0 +1,39 @@ + + + + + + + {{title}} + + + +
+

{{title}}

+ +
+
+ + +
+ × + Viewer Image + +
+
+ + + + + + + diff --git a/config/lab/storage_2024_03_07.ini b/config/lab/storage_2024_03_07.ini new file mode 100644 index 0000000..e1e46f8 --- /dev/null +++ b/config/lab/storage_2024_03_07.ini @@ -0,0 +1,14 @@ +[Settings] +title = The state of my box storage taken at 2024.03.07 +image_folder = pictures/lab/storage_2024_03_07 + +[Core] +template_path = assets/template.html +css_path = assets/style.css +js_path = assets/script.js + +[Output] +output_folder = docs/lab/storage_2024_03_07 +images_directory_name = images +core_directory_name = core +output_file_name = index.html \ No newline at end of file diff --git a/config/radioburzy/2024_leden.ini b/config/radioburzy/2024_leden.ini new file mode 100644 index 0000000..0bc7624 --- /dev/null +++ b/config/radioburzy/2024_leden.ini @@ -0,0 +1,14 @@ +[Settings] +title = Radioburza Leden 2024 +image_folder = pictures/radioburzy/2024_leden + +[Core] +template_path = assets/template.html +css_path = assets/style.css +js_path = assets/script.js + +[Output] +output_folder = docs/radioburzy/2024_leden +images_directory_name = images +core_directory_name = core +output_file_name = index.html \ No newline at end of file diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..4842fe9 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +zap.devvie.cc \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..a0845f0 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,56 @@ + + + + + + + 9551Dev's Electronics Gallery + + + + +
+

9551Dev's Electronics Gallery

+ +
+ + + \ No newline at end of file diff --git a/docs/lab/storage_2024_03_07/core/script.js b/docs/lab/storage_2024_03_07/core/script.js new file mode 100644 index 0000000..c69c91e --- /dev/null +++ b/docs/lab/storage_2024_03_07/core/script.js @@ -0,0 +1,96 @@ +var current_image_index = 0; +var image_paths = [ + "images/1.png" +]; + +function open_image_viewer(image_path) { + current_image_index = image_paths.indexOf(image_path); + update_image_viewer(); + document.querySelector(".image-viewer").style.display = "flex"; + document.body.style.overflow = "hidden"; + + document.addEventListener("keydown", handle_keypress); + + // Add event listener for mouse wheel + document.querySelector(".gallery").addEventListener("wheel", function(event) { + if (event.deltaY < 0) { + // Scrolling up + navigate_image(event, -1); + } else { + // Scrolling down + navigate_image(event, 1); + } + }); +} + +function close_image_viewer() { + var img = document.getElementById("viewer-image"); + img.style.transform = "scale(1)"; + document.querySelector(".image-viewer").style.display = "none"; + document.body.style.overflow = "auto"; + + document.removeEventListener("keydown", handle_keypress); + document.querySelector(".gallery").removeEventListener("wheel", handle_wheel); +} + +function navigate_image(event, direction) { + var img = document.getElementById("viewer-image"); + img.style.transform = "scale(1)"; + event.stopPropagation(); + current_image_index += direction; + if (current_image_index < 0) { + current_image_index = image_paths.length - 1; + } else if (current_image_index >= image_paths.length) { + current_image_index = 0; + } + update_image_viewer(); +} + +function update_image_viewer() { + document.getElementById("viewer-image").src = image_paths[current_image_index]; +} + +function toggle_dark_mode() { + var body = document.body; + body.classList.toggle("dark-mode"); +} + +function zoom_image(event) { + var img = document.getElementById("viewer-image"); + var bounding_rect = img.getBoundingClientRect(); + + var x = (event.clientX - bounding_rect.left) / bounding_rect.width; + var y = (event.clientY - bounding_rect.top) / bounding_rect.height; + + img.style.transformOrigin = `${x * 100}% ${y * 100}%`; + img.style.transform = img.style.transform === "scale(2)" ? "scale(1)" : "scale(2)"; + + event.stopPropagation(); +} + +function handle_keypress(event) { + if (document.querySelector(".image-viewer").style.display === "flex") { + switch(event.key) { + case "ArrowLeft": + navigate_image(event, -1); + break; + case "ArrowRight": + navigate_image(event, 1); + break; + case "Escape": + close_image_viewer(); + break; + } + } +} + +window.addEventListener("scroll", function () { + var body = document.body; + var scroll_position = window.scrollY; + + if (scroll_position > 0) { + body.classList.add("scrolled"); + } else { + body.classList.remove("scrolled"); + } +}); diff --git a/docs/lab/storage_2024_03_07/core/style.css b/docs/lab/storage_2024_03_07/core/style.css new file mode 100644 index 0000000..6225022 --- /dev/null +++ b/docs/lab/storage_2024_03_07/core/style.css @@ -0,0 +1,180 @@ +body { + margin: 0; + font-family: Arial, sans-serif; +} + +.header-box { + background-color: #333; + color: white; + padding: 15px; + text-align: center; + position: fixed; + width: 100%; + top: 0; + transition: top 0.3s; + z-index: 1; + display: flex; + justify-content: space-between; +} + +.header-box h1 { + margin: 0; +} + +.header-box button { + background-color: #4CAF50; + color: white; + padding: 10px 20px; + border: none; + border-radius: 5px; + cursor: pointer; + margin-left: auto; + margin-right: 30px; +} + +.github-link { + position: fixed; + bottom: 0; + right: 0; + display: flex; + align-items: center; + margin-left: auto; + margin-right: 5px; + margin-bottom: 5px; + margin-top: auto; +} + +.github-link img { + width: 40px; + margin-right: 5px; +} + +.content { + padding: 80px 16px; +} + +body.scrolled .header-box { + top: -100px; +} + +.gallery { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 10px; +} +img { + max-width: 100%; + max-height: 400px; + height: auto; + border: 2px solid #ddd; + border-radius: 8px; + transition: 0.3s; + cursor: pointer; +} +img:hover { + border: 2px solid #777; + transition: transform 0.3s ease-out; +} +.image-viewer { + z-index: 3; + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.8); + justify-content: center; + align-items: center; +} + +.image-viewer img { + max-width: 90%; + max-height: 90%; + cursor: zoom-in; /* add cursor style for zooming in */ + transition: transform 0.5s ease-out; +} +.close-btn { + font-size: 40px; + color: white; + cursor: pointer; + position: absolute; + top: 10px; + right: 20px; + z-index: 1; +} +.nav-arrows { + position: fixed; + top: 50%; + display: flex; + justify-content: space-between; + width: 100%; + padding: 0 20px; + z-index: 1; +} + +.nav-arrow { + font-size: 60px; + color: white; + cursor: pointer; + padding: 20px; + position: relative; +} + +.nav-arrow-left { + margin-left: 20px; +} + +.nav-arrow-right { + margin-right: 20px; +} + +.nav-arrow-left:before, +.nav-arrow-right:before { + content: ''; + position: absolute; + top: -20px; + right: -20px; + bottom: -20px; + left: -20px; +} + +.dark-mode-btn { + top: 10px; + right: 10px; + cursor: pointer; + font-size: 18px; + padding: 5px; + background-color: #333; + color: #fff; + border: none; + border-radius: 5px; + transition: background-color 0.3s ease, color 0.3s ease; +} + +body.dark-mode { + background-color: #2a2a2a; + color: #fff; +} + +body.dark-mode .header-box { + background-color: #111; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); +} + +body.dark-mode .header-box h1 { + color: #fff; +} + +body.dark-mode * { + border-color: #333; +} + +body.dark-mode .content { + background-color: #2a2a2a; +} + +.viewed-image { + z-index: 2; +} diff --git a/docs/lab/storage_2024_03_07/images/1.png b/docs/lab/storage_2024_03_07/images/1.png new file mode 100644 index 0000000..da78e4e Binary files /dev/null and b/docs/lab/storage_2024_03_07/images/1.png differ diff --git a/docs/lab/storage_2024_03_07/index.html b/docs/lab/storage_2024_03_07/index.html new file mode 100644 index 0000000..8e15580 --- /dev/null +++ b/docs/lab/storage_2024_03_07/index.html @@ -0,0 +1,39 @@ + + + + + + + The state of my box storage taken at 2024.03.07 + + + +
+

The state of my box storage taken at 2024.03.07

+ +
+
+ + +
+ × + Viewer Image + +
+
+ + + + + + + diff --git a/docs/radioburzy/2024_leden/core/script.js b/docs/radioburzy/2024_leden/core/script.js new file mode 100644 index 0000000..b939d65 --- /dev/null +++ b/docs/radioburzy/2024_leden/core/script.js @@ -0,0 +1,96 @@ +var current_image_index = 0; +var image_paths = [ + "images/IMG_0531.JPG" +]; + +function open_image_viewer(image_path) { + current_image_index = image_paths.indexOf(image_path); + update_image_viewer(); + document.querySelector(".image-viewer").style.display = "flex"; + document.body.style.overflow = "hidden"; + + document.addEventListener("keydown", handle_keypress); + + // Add event listener for mouse wheel + document.querySelector(".gallery").addEventListener("wheel", function(event) { + if (event.deltaY < 0) { + // Scrolling up + navigate_image(event, -1); + } else { + // Scrolling down + navigate_image(event, 1); + } + }); +} + +function close_image_viewer() { + var img = document.getElementById("viewer-image"); + img.style.transform = "scale(1)"; + document.querySelector(".image-viewer").style.display = "none"; + document.body.style.overflow = "auto"; + + document.removeEventListener("keydown", handle_keypress); + document.querySelector(".gallery").removeEventListener("wheel", handle_wheel); +} + +function navigate_image(event, direction) { + var img = document.getElementById("viewer-image"); + img.style.transform = "scale(1)"; + event.stopPropagation(); + current_image_index += direction; + if (current_image_index < 0) { + current_image_index = image_paths.length - 1; + } else if (current_image_index >= image_paths.length) { + current_image_index = 0; + } + update_image_viewer(); +} + +function update_image_viewer() { + document.getElementById("viewer-image").src = image_paths[current_image_index]; +} + +function toggle_dark_mode() { + var body = document.body; + body.classList.toggle("dark-mode"); +} + +function zoom_image(event) { + var img = document.getElementById("viewer-image"); + var bounding_rect = img.getBoundingClientRect(); + + var x = (event.clientX - bounding_rect.left) / bounding_rect.width; + var y = (event.clientY - bounding_rect.top) / bounding_rect.height; + + img.style.transformOrigin = `${x * 100}% ${y * 100}%`; + img.style.transform = img.style.transform === "scale(2)" ? "scale(1)" : "scale(2)"; + + event.stopPropagation(); +} + +function handle_keypress(event) { + if (document.querySelector(".image-viewer").style.display === "flex") { + switch(event.key) { + case "ArrowLeft": + navigate_image(event, -1); + break; + case "ArrowRight": + navigate_image(event, 1); + break; + case "Escape": + close_image_viewer(); + break; + } + } +} + +window.addEventListener("scroll", function () { + var body = document.body; + var scroll_position = window.scrollY; + + if (scroll_position > 0) { + body.classList.add("scrolled"); + } else { + body.classList.remove("scrolled"); + } +}); diff --git a/docs/radioburzy/2024_leden/core/style.css b/docs/radioburzy/2024_leden/core/style.css new file mode 100644 index 0000000..6225022 --- /dev/null +++ b/docs/radioburzy/2024_leden/core/style.css @@ -0,0 +1,180 @@ +body { + margin: 0; + font-family: Arial, sans-serif; +} + +.header-box { + background-color: #333; + color: white; + padding: 15px; + text-align: center; + position: fixed; + width: 100%; + top: 0; + transition: top 0.3s; + z-index: 1; + display: flex; + justify-content: space-between; +} + +.header-box h1 { + margin: 0; +} + +.header-box button { + background-color: #4CAF50; + color: white; + padding: 10px 20px; + border: none; + border-radius: 5px; + cursor: pointer; + margin-left: auto; + margin-right: 30px; +} + +.github-link { + position: fixed; + bottom: 0; + right: 0; + display: flex; + align-items: center; + margin-left: auto; + margin-right: 5px; + margin-bottom: 5px; + margin-top: auto; +} + +.github-link img { + width: 40px; + margin-right: 5px; +} + +.content { + padding: 80px 16px; +} + +body.scrolled .header-box { + top: -100px; +} + +.gallery { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 10px; +} +img { + max-width: 100%; + max-height: 400px; + height: auto; + border: 2px solid #ddd; + border-radius: 8px; + transition: 0.3s; + cursor: pointer; +} +img:hover { + border: 2px solid #777; + transition: transform 0.3s ease-out; +} +.image-viewer { + z-index: 3; + display: none; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.8); + justify-content: center; + align-items: center; +} + +.image-viewer img { + max-width: 90%; + max-height: 90%; + cursor: zoom-in; /* add cursor style for zooming in */ + transition: transform 0.5s ease-out; +} +.close-btn { + font-size: 40px; + color: white; + cursor: pointer; + position: absolute; + top: 10px; + right: 20px; + z-index: 1; +} +.nav-arrows { + position: fixed; + top: 50%; + display: flex; + justify-content: space-between; + width: 100%; + padding: 0 20px; + z-index: 1; +} + +.nav-arrow { + font-size: 60px; + color: white; + cursor: pointer; + padding: 20px; + position: relative; +} + +.nav-arrow-left { + margin-left: 20px; +} + +.nav-arrow-right { + margin-right: 20px; +} + +.nav-arrow-left:before, +.nav-arrow-right:before { + content: ''; + position: absolute; + top: -20px; + right: -20px; + bottom: -20px; + left: -20px; +} + +.dark-mode-btn { + top: 10px; + right: 10px; + cursor: pointer; + font-size: 18px; + padding: 5px; + background-color: #333; + color: #fff; + border: none; + border-radius: 5px; + transition: background-color 0.3s ease, color 0.3s ease; +} + +body.dark-mode { + background-color: #2a2a2a; + color: #fff; +} + +body.dark-mode .header-box { + background-color: #111; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); +} + +body.dark-mode .header-box h1 { + color: #fff; +} + +body.dark-mode * { + border-color: #333; +} + +body.dark-mode .content { + background-color: #2a2a2a; +} + +.viewed-image { + z-index: 2; +} diff --git a/docs/radioburzy/2024_leden/images/IMG_0531.JPG b/docs/radioburzy/2024_leden/images/IMG_0531.JPG new file mode 100644 index 0000000..bc82436 Binary files /dev/null and b/docs/radioburzy/2024_leden/images/IMG_0531.JPG differ diff --git a/docs/radioburzy/2024_leden/index.html b/docs/radioburzy/2024_leden/index.html new file mode 100644 index 0000000..50297dd --- /dev/null +++ b/docs/radioburzy/2024_leden/index.html @@ -0,0 +1,39 @@ + + + + + + + Radioburza Leden 2024 + + + +
+

Radioburza Leden 2024

+ +
+
+ + +
+ × + Viewer Image + +
+
+ + + + + + + diff --git a/gallery_generator.py b/gallery_generator.py new file mode 100644 index 0000000..9f04cd7 --- /dev/null +++ b/gallery_generator.py @@ -0,0 +1,119 @@ +import os +import sys +import configparser +import shutil + +def check_file_exists(file_path): + if not os.path.exists(file_path): + print(f"Error: File not found: {file_path}") + return False + return True + +def check_folder_exists(folder_path): + if not os.path.exists(folder_path): + print(f"Error: Folder not found: {folder_path}") + return False + return True + +def read_config(config_path): + print("Reading configuration...") + config = configparser.ConfigParser() + config.read(config_path) + + title = config.get('Settings', 'title') + image_folder = config.get('Settings', 'image_folder') + + template_path = config.get('Core', 'template_path') + css_path = config.get('Core', 'css_path') + js_path = config.get('Core', 'js_path') + + output_folder = config.get('Output', 'output_folder') + images_directory_name = config.get('Output', 'images_directory_name') + core_directory_name = config.get('Output', 'core_directory_name') + output_file_name = config.get('Output', 'output_file_name') + + if not check_folder_exists(image_folder): + print("Exiting: Image folder not found.") + exit(1) + if not (check_file_exists(template_path) and check_file_exists(css_path) and check_file_exists(js_path)): + print("Exiting: One or more core files not found.") + exit(1) + + print("Configuration read successfully.") + return title, image_folder, template_path, css_path, js_path, output_folder, images_directory_name, core_directory_name, output_file_name + +def get_image_filenames(image_folder): + print(f"Scanning image folder: {image_folder}") + image_files = [f for f in os.listdir(image_folder) if f.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp'))] + print(f"Found {len(image_files)} image(s):") + for image_file in image_files: + print(f" - {image_file}") + return sorted(image_files) + +def generate_html(title, image_folder, template_path, css_path, js_path, output_folder, images_directory_name, core_directory_name, output_file_name): + print("\nGenerating HTML...") + with open(template_path, 'r') as template_file: + template_content = template_file.read() + with open(js_path, 'r') as js_file: + js_content = js_file.read() + with open(css_path, 'r') as css_file: + css_content = css_file.read() + + image_files = get_image_filenames(image_folder) + image_paths = [os.path.join(images_directory_name, os.path.basename(image_file)) for image_file in image_files] + + output_images_folder = os.path.join(output_folder, images_directory_name) + os.makedirs(output_images_folder, exist_ok=True) + + for image_file, image_path in zip(image_files, image_paths): + print(f"Copying image: {image_file} to {output_images_folder}") + shutil.copy(os.path.join(image_folder, image_file), output_images_folder) + + copied_image_paths = [f'"{path}"' for path in image_paths] + image_tags = '\n'.join([f' {os.path.basename(path)}' + for path in copied_image_paths]) + + template_content = template_content.replace('{{title}}', title) + template_content = template_content.replace('{{css_path}}', os.path.join(core_directory_name, os.path.basename(css_path))) + template_content = template_content.replace('{{js_path}}', os.path.join(core_directory_name, os.path.basename(js_path))) + template_content = template_content.replace('{{image_tags}}', image_tags) + + image_paths_js = ",\n ".join(copied_image_paths) + js_content = js_content.replace('{{image_paths}}', image_paths_js) + + output_core_folder = os.path.join(output_folder, core_directory_name) + os.makedirs(output_core_folder, exist_ok=True) + + output_js_path = os.path.join(output_core_folder, os.path.basename(js_path)) + with open(output_js_path, 'w') as output_js_file: + output_js_file.write(js_content) + + output_css_path = os.path.join(output_core_folder, os.path.basename(css_path)) + with open(output_css_path, 'w') as output_css_file: + output_css_file.write(css_content) + + output_file_path = os.path.join(output_folder, output_file_name) + with open(output_file_path, 'w') as output_file: + output_file.write(template_content) + + print(f'Generated {output_file_path} successfully.') + +if __name__ == '__main__': + if len(sys.argv) != 2: + print("Usage: python script.py [config_path]") + exit(1) + + config_path = sys.argv[1] + title, image_folder, template_path, css_path, js_path, output_folder, images_directory_name, core_directory_name, output_file_name = read_config(config_path) + + print(f'\nTitle: {title}') + print(f'Image Folder: {image_folder}') + print(f'Template Path: {template_path}') + print(f'CSS Path: {css_path}') + print(f'JS Path: {js_path}') + print(f'Output Folder: {output_folder}') + print(f'Images Directory Name: {images_directory_name}') + print(f'Core Directory Name: {core_directory_name}') + print(f'Output File Name: {output_file_name}') + + generate_html(title, image_folder, template_path, css_path, js_path, output_folder, images_directory_name, core_directory_name, output_file_name) diff --git a/generate.sh b/generate.sh new file mode 100755 index 0000000..394bf0d --- /dev/null +++ b/generate.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# radioburzy +python3 ./gallery_generator.py config/radioburzy/2024_leden.ini + +# laboratoř EE +python3 ./gallery_generator.py config/lab/storage_2024_03_07.ini \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..a0845f0 --- /dev/null +++ b/index.html @@ -0,0 +1,56 @@ + + + + + + + 9551Dev's Electronics Gallery + + + + +
+

9551Dev's Electronics Gallery

+ +
+ + + \ No newline at end of file diff --git a/pictures/lab/storage_2024_03_07/1.png b/pictures/lab/storage_2024_03_07/1.png new file mode 100644 index 0000000..da78e4e Binary files /dev/null and b/pictures/lab/storage_2024_03_07/1.png differ diff --git a/pictures/radioburzy/2024_leden/IMG_0531.JPG b/pictures/radioburzy/2024_leden/IMG_0531.JPG new file mode 100644 index 0000000..bc82436 Binary files /dev/null and b/pictures/radioburzy/2024_leden/IMG_0531.JPG differ