bpb-website/gallery/organic/updateGallery.sh
2025-03-17 21:33:13 -04:00

262 lines
10 KiB
Bash
Executable File

#!/bin/bash
# Directory where images are stored (Quote it!)
IMAGE_DIR="../../assets/pics/gallery/organic"
# Output file (Quote it!)
OUTPUT_FILE="./index.html" # Or specify the full path: /path/to/your/file/index.html
# Ensure the images directory exists
if [ ! -d "$IMAGE_DIR" ]; then
echo "Error: Directory '$IMAGE_DIR' not found!"
exit 1
fi
# Start writing the HTML file (Redirect to the quoted variable)
cat > "$OUTPUT_FILE" <<EOL
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="apple-touch-icon" sizes="180x180" href="../../assets/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="../../assets/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../../assets/favicon/favicon-16x16.png">
<link rel="manifest" href="../../assets/favicon/site.webmanifest">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Beach Party Balloons - Your go-to shop for stunning balloon decorations, walk-in arrangements, and deliveries in CT.">
<title>Beach Party Balloons</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bulma@1.0.2/css/bulma.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Autour+One&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../../style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css" integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
.gallery {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
padding: 20px;
max-width: 1200px;
margin: auto;
}
.gallery-item {
text-align: center;
}
.gallery img {
object-fit: cover;
border-radius: 10px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer; /* Make images clickable */
}
.gallery img:hover {
transform: scale(1.05);
box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.2);
}
.caption {
font-size: 0.9rem;
margin-top: 5px;
color: #4a4a4a;
font-family: 'Autour One', cursive;
}
.modal{
--bulma-modal-content-width: 95vw;
--bulma-modal-content-height: 95vh;
}
.modal-image {
width: auto;
height: auto;
max-width: 90vw;
max-height: 90vh;
object-fit: contain; /* Ensures the whole image is visible without cropping */
display: block;
}
.modal-card {
width: auto;
max-width: 90vw; /* Ensures the modal is responsive */
max-height: 90vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: transparent; /* Keeps the background consistent */
overflow: hidden;
}
.modal-content {
overflow-y: none;
max-height: 95vh;
background-color: transparent !important;
}
.modal-card-title {
font-family: 'Autour One', cursive;
background-color: transparent !important;
font-size: 1rem;
}
.modal-card-body{
display: flex;
justify-content: center;
align-items: center;
max-width: 100%;
max-height: 100%;
overflow: hidden;
}
body.modal-open {
overflow: hidden;
}
.delete{
margin-left: 10px;}
</style>
</head>
<body>
<nav class="navbar is-info is-spaced has-shadow" role="navigation" aria-label="main navigation">
<div class="navbar-brand is-size-1">
<a class="navbar-item" href="../../">
<img style="background-color: white;" src="../../assets/logo/BeachPartyBalloons-logo.webp" alt="Beach Party Balloons logo">
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu has-text-right">
<div class="navbar-end">
<a class="navbar-item" href="../../">Home</a>
<a class="navbar-item" href="../../about/">About Us</a>
<a class="navbar-item" href="../../faq/">FAQ</a>
<a class="navbar-item" href="../../terms/">Terms</a>
<a class="navbar-item is-tab is-active" href="../../gallery/">Gallery</a>
<a class="navbar-item" href="../../contact/">Contact</a>
</div>
</div>
</nav>
<nav class="breadcrumb is-centered" aria-label="breadcrumbs">
<ul>
<li><a href="../">Gallery</a></li>
<li class="is-active"><a href="#" aria-current="page">Organic</a></li>
</ul>
</nav>
<button onclick="topFunction()" class="has-text-dark" id="top" title="Go to top">Top</button>
<section class="section">
<div class="container">
<h1 class="title has-text-centered has-text-dark">Organic Balloon Décor</h1>
<div class="gallery">
EOL
count=1
for img in "$IMAGE_DIR"/*.{jpg,jpeg,png,gif,webp}; do
if [[ -f "$img" ]]; then
filename=$(basename "$img")
caption_file="${img%.*}.txt"
if [[ -f "$caption_file" ]]; then
caption=$(cat "$caption_file")
else
caption=""
fi
printf " <div class=\"gallery-item\">\n" >> "$OUTPUT_FILE"
printf " <figure class=\"image is-square\">\n" >> "$OUTPUT_FILE"
printf " <img loading="lazy" src=\"%s\" alt=\"%s\" data-target=\"modal%d\" aria-haspopup=\"true\">\n" "$IMAGE_DIR/$filename" "$caption" "$count" >> "$OUTPUT_FILE"
printf " </figure>\n" >> "$OUTPUT_FILE"
printf " <p class=\"caption\">%s</p>\n" "$caption" >> "$OUTPUT_FILE"
printf " </div>\n" >> "$OUTPUT_FILE"
# Modal structure
printf " <div class=\"modal\" id=\"modal%d\">\n" "$count" >> "$OUTPUT_FILE"
printf " <div class=\"modal-background\"></div>\n" >> "$OUTPUT_FILE"
printf " <div class=\"modal-card\">\n" >> "$OUTPUT_FILE"
printf " <header class=\"modal-card-head\">\n" >> "$OUTPUT_FILE"
printf " <p class=\"modal-card-title has-size-4\">%s</p>\n" "$caption" >> "$OUTPUT_FILE"
printf " <button class=\"delete\" aria-label=\"close\" data-action=\"close\"></button>\n" >> "$OUTPUT_FILE"
printf " </header>\n" >> "$OUTPUT_FILE"
printf " <section class=\"modal-card-body\">\n" >> "$OUTPUT_FILE"
printf " <img class=\"modal-image\" src=\"%s\" alt=\"%s\">\n" "$IMAGE_DIR/$filename" "$caption" >> "$OUTPUT_FILE"
printf " </section>\n" >> "$OUTPUT_FILE"
printf " </div>\n" >> "$OUTPUT_FILE"
printf " </div>\n" >> "$OUTPUT_FILE"
count=$((count+1))
fi
done
cat >> "$OUTPUT_FILE" <<EOL
</div>
</div>
</section>
<script>
document.addEventListener('DOMContentLoaded', () => {
function openModal(modalId) {
const modal = document.getElementById(modalId);
modal.classList.add('is-active');
}
function closeModal(modal) {
modal.classList.remove('is-active');
}
const images = document.querySelectorAll('.gallery img');
images.forEach(image => {
image.addEventListener('click', () => {
const targetModal = image.dataset.target;
openModal(targetModal);
});
});
const closeButtons = document.querySelectorAll('.modal .delete[data-action="close"]');
closeButtons.forEach(button => {
button.addEventListener('click', () => {
const modal = button.closest('.modal');
closeModal(modal);
});
});
const modalBackgrounds = document.querySelectorAll('.modal-background');
modalBackgrounds.forEach(background => {
background.addEventListener('click', () => {
const modal = background.closest('.modal');
closeModal(modal);
});
});
});
</script>
<footer class="footer has-background-primary-light">
<div class="content has-text-centered">
<div>
<a target="_blank" href="https://mastodon.social/@beachpartyballoons@mastodon.social"><i class="fa-brands fa-mastodon is-size-2"></i>
</a>
<a target="_blank" href="https://www.facebook.com/beachpartyballoons"><i class="fa-brands fa-facebook-f is-size-2"></i>
</a>
<a target="_blank" href="https://www.instagram.com/beachpartyballoons/"><i class="fa-brands fa-instagram is-size-2"></i>
</a>
<a target="_blank" href="https://bsky.app/profile/beachpartyballoons.bsky.social">
<i class="fa-brands fa-bluesky is-size-2"></i>
</a>
</div>
<h7>Copyright &copy; <span id="year"></span> Beach Party Balloons</h7>
<h7>All images & content are property of Beach Party Balloons. Use of images without written permission is prohibited.</h7>
</div>
</footer>
<script src="../../script.js"></script>
<script defer data-domain="beachpartyballoons.com" src="https://metrics.beachpartyballoons.com/js/script.js"></script>
</body>
</html>
EOL
echo "Gallery generated with Bulma modals! Open $OUTPUT_FILE in your browser."