Portfolio image captions and dates
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Rik Berkelder 2025-03-03 03:11:48 +01:00
parent 2102441dd2
commit beaa79b377
50 changed files with 124 additions and 76 deletions

View file

@ -73,6 +73,8 @@
new SimpleLightbox('.gallery a', { new SimpleLightbox('.gallery a', {
widthRatio: 0.9, widthRatio: 0.9,
heightRatio: 0.95, heightRatio: 0.95,
captionSelector: '.gallery-caption',
captionType: 'text',
}); });
</script> </script>
</body> </body>

View file

@ -13,7 +13,16 @@ layout: base.njk
</div> </div>
<div class="portfolio-detail-images gallery"> <div class="portfolio-detail-images gallery">
{% for image in data.images %} {% for image in data.images %}
<a href="{% imageUrl image %}"><img src="{{image}}" alt="" loading="lazy" /></a> <a href="{% imageUrl image.url %}">
<img src="{{image.url}}" alt="" loading="lazy" />
{% if image.caption %}
<div class="gallery-caption">
{{image.caption}}
<small class="d-inline-block"> - {{image.date | dateLocale}}</small>
</div>
{% endif %}
</a>
{% endfor %} {% endfor %}
</div> </div>

View file

@ -14,7 +14,7 @@ permalink: "/portfolio/"
<a href="{{portfolioItem.data.page.url | safe}}"> <a href="{{portfolioItem.data.page.url | safe}}">
<div class="flex"> <div class="flex">
{% for image in portfolioItem.data.images.slice(0,3) %} {% for image in portfolioItem.data.images.slice(0,3) %}
<img src={{image}} alt="" width="400" /> <img src={{image.url}} alt="" width="400" />
{% endfor %} {% endfor %}
</div> </div>
</a> </a>

BIN
content/portfolio/luxorlive/1.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/2.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/3.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/31.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
content/portfolio/luxorlive/4.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/41.jpg (Stored with Git LFS) Normal file

Binary file not shown.

BIN
content/portfolio/luxorlive/5.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/6.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/7.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/8.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/9.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/luxorlive/91.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/musis/1.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/musis/3.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/musis/4.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/musis/5.jpg (Stored with Git LFS)

Binary file not shown.

View file

@ -1,17 +1,31 @@
import * as path from 'node:path'; import * as path from 'node:path';
import * as fs from 'node:fs'; import * as fs from 'node:fs';
import exifr from 'exifr';
const conf = { const conf = {
tags: "portfolio", tags: "portfolio",
layout: "portfolio.njk", layout: "portfolio.njk",
eleventyComputed: { eleventyComputed: {
images(data) { async images(data) {
const dir = path.dirname(data.page.inputPath); const dir = path.dirname(data.page.inputPath);
const images = fs.readdirSync(dir) const files = fs.readdirSync(dir)
.filter(file => ['.png', '.jpg', '.jpeg', '.JPG'].includes(path.extname(file))) .filter(file => ['.png', '.jpg', '.jpeg', '.JPG'].includes(path.extname(file)))
.sort() .sort();
.map(image => `${data.page.url}${image}`);
const images = await Promise.all(files.map(async (image) => {
const imagePath = path.resolve(dir + '/' + image);
const exif = await exifr.parse(imagePath, { pick: ['XPComment', 'DateTimeOriginal'] });
return {
url: data.page.url + image,
caption: exif?.XPComment ?? "",
date: exif?.DateTimeOriginal
};
}));
return images; return images;
}, },

BIN
content/portfolio/sowulo/1.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/sowulo/2.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/sowulo/3.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/sowulo/4.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/sowulo/41.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/sowulo/42.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/sowulo/5.jpg (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/sowulo/6.jpg (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/001.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/002.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/003.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/004.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/005.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/006.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/007.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/008.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/009.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/010.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/011.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/012.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/tivolivredenburg/013.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/willemeen/01.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/willemeen/02.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/willemeen/03.JPG (Stored with Git LFS)

Binary file not shown.

BIN
content/portfolio/willemeen/05.JPG (Stored with Git LFS)

Binary file not shown.

View file

@ -214,7 +214,7 @@ body {
} }
} }
figure { figure.styled-figure {
background-color: $grey-dark; background-color: $grey-dark;
display: inline-block; display: inline-block;
padding: 0.5rem; padding: 0.5rem;
@ -348,14 +348,24 @@ body {
.gallery a { .gallery a {
display: inline-block; display: inline-block;
position: relative;
overflow: hidden; overflow: hidden;
img { img {
transition: transform 0.3s; transition: transform 0.3s;
&:hover { &:hover {
transform: scale(1.1); transform: scale(1.1);
} }
} }
.gallery-caption {
color: $text-default;
position: absolute;
bottom: 0px;
background-color: #00000088;
width: 100%;
padding: 0.3rem 0.4rem;
}
} }

View file

@ -8,7 +8,7 @@ import cacheBuster from 'eleventy-auto-cache-buster';
export default async function (eleventyConfig) { export default async function (eleventyConfig) {
// Filters // Filters
eleventyConfig.addFilter("dateLocale", function (value) { eleventyConfig.addFilter("dateLocale", function (value) {
return DateTime.fromISO(new Date(value).toISOString()).toLocaleString({ return DateTime.fromJSDate(new Date(value)).toLocaleString({
year: 'numeric', year: 'numeric',
month: 'short', month: 'short',
day: '2-digit', day: '2-digit',
@ -35,7 +35,7 @@ export default async function (eleventyConfig) {
}); });
eleventyConfig.addShortcode("figure", (url, alt, caption, width) => { eleventyConfig.addShortcode("figure", (url, alt, caption, width) => {
return ` return `
<figure> <figure class="styled-figure">
<img src="${url}" alt="${alt}" width="${width || "700"}" /> <img src="${url}" alt="${alt}" width="${width || "700"}" />
<figcaption>${caption}</figcaption> <figcaption>${caption}</figcaption>
</figure> </figure>
@ -75,6 +75,8 @@ export default async function (eleventyConfig) {
return sorted; return sorted;
}); });
eleventyConfig.addWatchTarget("content/portfolio/**/*");
} }
export const config = { export const config = {

7
package-lock.json generated
View file

@ -12,6 +12,7 @@
"@11ty/eleventy": "^3.0.0", "@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-img": "^6.0.1", "@11ty/eleventy-img": "^6.0.1",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0", "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"exifr": "^7.1.3",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"sass": "^1.83.4" "sass": "^1.83.4"
}, },
@ -1703,6 +1704,12 @@
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/exifr": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/exifr/-/exifr-7.1.3.tgz",
"integrity": "sha512-g/aje2noHivrRSLbAUtBPWFbxKdKhgj/xr1vATDdUXPOFYJlQ62Ft0oy+72V6XLIpDJfHs6gXLbBLAolqOXYRw==",
"license": "MIT"
},
"node_modules/extend-shallow": { "node_modules/extend-shallow": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",

View file

@ -16,6 +16,7 @@
"@11ty/eleventy": "^3.0.0", "@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-img": "^6.0.1", "@11ty/eleventy-img": "^6.0.1",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0", "@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"exifr": "^7.1.3",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"sass": "^1.83.4" "sass": "^1.83.4"
}, },