Refactor CSS and image processing in generateSite.js to enhance responsiveness and loading behavior. Updated styles for progressive image containers and thumbnails, ensuring proper aspect ratio and centering. Added image rotation during processing to maintain orientation. This improves visual presentation and user experience across the site.

This commit is contained in:
Knight 2024-12-28 11:52:12 -05:00
parent 3920a68c6e
commit 2611988636

View File

@ -55,8 +55,9 @@ async function generateSite() {
.progressive-image-container {
position: relative;
width: 100%;
height: 100%;
aspect-ratio: 1;
max-width: 100vw;
height: auto;
margin: 0 auto;
}
.progressive-image {
position: absolute;
@ -65,6 +66,7 @@ async function generateSite() {
width: 100%;
height: 100%;
object-fit: contain;
max-width: 100%;
transition: opacity 0.5s ease-in-out;
}
.thumbnail {
@ -163,11 +165,13 @@ async function serveStaticSite(port = 3000) {
width: originalMetadata.width,
height: originalMetadata.height,
size: originalMetadata.size,
format: originalMetadata.format
format: originalMetadata.format,
orientation: originalMetadata.orientation
});
// Process the image
const processedImage = await Sharp(filePath)
.rotate()
.resize({
width: parseInt(width),
height: parseInt(width),