feat: add image processing, improvements

This commit is contained in:
2026-02-12 22:57:49 +01:00
parent 3cb1797091
commit 889e7047ac
8 changed files with 55 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ title: "The burden of knowledge: dealing with open-source risks"
date: 2025-03-10 date: 2025-03-10
categories: categories:
- english - english
- news - article
tags: tags:
- OSPO - OSPO
- Community - Community

View File

@@ -18,5 +18,3 @@ event:
--- ---
I had the pleasure to moderate the OpenRail Day 2025 in Paris, organised by the [OpenRail Association](https://openrailassociation.org) to share knowledge and experiences about open source software in the railway industry. The event featured several talks and panel discussions with experts from different companies and organisations involved in open source projects related to railways. I had the pleasure to moderate the OpenRail Day 2025 in Paris, organised by the [OpenRail Association](https://openrailassociation.org) to share knowledge and experiences about open source software in the railway industry. The event featured several talks and panel discussions with experts from different companies and organisations involved in open source projects related to railways.
![](openrailday-stage.jpg)

View File

@@ -336,6 +336,10 @@ pre code {
} }
} }
h4 span {
cursor: default;
}
h1, h1,
h4 a { h4 a {
color: var(--primary-color-dark); color: var(--primary-color-dark);

View File

@@ -63,7 +63,7 @@
{{ range .Paginator.Pages.ByPublishDate.Reverse }} {{ range .Paginator.Pages.ByPublishDate.Reverse }}
<div class="blog-summary"> <div class="blog-summary">
<h4> <h4>
{{- partial "blog/pre-headline.html" . -}} {{ partial "blog/pre-headline.html" . -}}
<strong><a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a></strong> <strong><a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a></strong>
</h4> </h4>
<div class="metadata-summary"> <div class="metadata-summary">

View File

@@ -1,15 +1,21 @@
{{- $page := . -}} {{- $page := . -}}
{{- $image := "" }}
{{- with $page.Params.headerimage }} {{- with $page.Params.headerimage }}
<div class="header-image"> <div class="header-image">
{{- if eq $page.BundleType "leaf" }} {{- if eq $page.BundleType "leaf" }}
{{- with $page.Resources.GetMatch .src }} {{- with $page.Resources.GetMatch .src }}
<img src="{{ .RelPermalink }}" /> {{- $image = . }}
{{- end }} {{- end }}
{{- else }} {{- else }}
{{- with resources.GetMatch (printf "**/%s" .src) }} {{- with resources.GetMatch (printf "**/%s" .src) }}
<img src="{{ .RelPermalink }}" /> {{- $image = . }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- $processes := .processes | default (slice "fill 1000x440 webp" )}}
{{- $image = partial "image-processing" (dict "image" $image "processes" $processes "filter" .filter) -}}
{{- with $image }}
<img src="{{ .RelPermalink }}" />
{{- end }}
{{- with .text }}<p>{{ . | markdownify }}</p>{{ end }} {{- with .text }}<p>{{ . | markdownify }}</p>{{ end }}
</div> </div>
{{- end }} {{- end }}

View File

@@ -1,9 +1,13 @@
{{- $cats := .Page.Params.categories }} {{- $cats := .Page.Params.categories }}
{{- $symbols := dict "news" "🗞️" "presentation" "🎤" "podcast" "🎧" }} {{- $symbols := dict "article" "🗞️" "presentation" "🎤" "podcast" "🎧" }}
{{- $selection := "" }} {{- $icon := "" }}
{{- $title := "" }}
{{- range $cat := $cats }} {{- range $cat := $cats }}
{{- with index $symbols $cat }} {{- with index $symbols $cat }}
{{- $selection = (printf "%s&nbsp;&nbsp;" .) | safeHTML }} {{- $icon = . }}
{{- $title = $cat | humanize }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- return $selection }} {{- with $icon }}
<span title="{{ $title }}">{{ $icon }}&nbsp;&nbsp;</span>
{{- end -}}

View File

@@ -1,5 +1,5 @@
{{- $cats := .Page.Params.categories }} {{- $cats := .Page.Params.categories }}
{{- $symbols := dict "news" "Article published" "presentation" "Presentation given" "podcast" "Podcast released" }} {{- $symbols := dict "article" "Article published" "presentation" "Presentation given" "podcast" "Podcast released" }}
{{- $selection := "" }} {{- $selection := "" }}
{{- range $cat := $cats }} {{- range $cat := $cats }}
{{- with index $symbols $cat }} {{- with index $symbols $cat }}

View File

@@ -0,0 +1,32 @@
{{- /* Expects .image (resolved image resource), optionally .processes and .filter */}}
{{- $image := .image }}
{{- range .processes }}
{{- $image = $image.Process . }}
{{- end }}
{{- with .filter }}
{{- $filters := slice }}
{{- range . }}
{{- range $method, $args := . }}
{{/* No, this cannot be generalised, as strings cannot be converted to functions... */}}
{{- if eq $method "GaussianBlur" }}
{{- $filters = $filters | append (images.GaussianBlur $args) }}
{{- else if eq $method "Brightness" }}
{{- $filters = $filters | append (images.Brightness $args) }}
{{- else if eq $method "Opacity" }}
{{- $filters = $filters | append (images.Opacity $args) }}
{{- else if eq $method "Pixelate" }}
{{- $filters = $filters | append (images.Pixelate $args) }}
{{- else if eq $method "Saturation" }}
{{- $filters = $filters | append (images.Saturation $args) }}
{{- else if eq $method "Sepia" }}
{{- $filters = $filters | append (images.Sepia $args) }}
{{- else if eq $method "Grayscale" }}
{{- $filters = $filters | append images.Grayscale }}
{{- else }}
{{- warnf "Unsupported filter: %s" $method }}
{{- end }}
{{- end }}
{{- end }}
{{- $image = $image.Filter $filters }}
{{- end }}
{{- return $image }}