mirror of
https://github.com/yuzu-emu/shared-bulma-theme.git
synced 2024-11-22 18:45:41 +01:00
34 lines
1.4 KiB
HTML
34 lines
1.4 KiB
HTML
{{ $originals := (.Page.Resources.ByType "image") }}
|
|
<div class="columns is-img-preview">
|
|
{{ range $param := .Params }}
|
|
<!-- image -->
|
|
{{ $items := split $param "|" }}
|
|
{{ $src := (index $items 0) }}
|
|
{{ $title := (index $items 1) }}
|
|
{{ $split_src := split $src "." }}
|
|
{{ $extension := index $split_src (sub (len $split_src) 1) }}
|
|
<div class="column has-text-centered">
|
|
{{ if eq $extension "mp4" }}
|
|
<video preload="auto" autoplay="autoplay" muted="muted" loop="loop" webkit-playsinline="">
|
|
<source src="{{ $src }}" type="video/mp4">
|
|
Your browser doesn't support mp4 video. :(
|
|
</video>
|
|
{{ else }}
|
|
<a href="{{ $src }}" title="{{ $title }}">
|
|
{{- if eq $extension "png" -}}
|
|
{{ $original := $originals.GetMatch (printf "*%s" (path.Base $src)) }}
|
|
{{ $resized_width := math.Min $original.Width 1024 }}
|
|
{{ $resized := $original.Resize (print $resized_width "x q90 jpg" ) }}
|
|
<img src="{{ $resized.Permalink }}" alt="{{ $title }}">
|
|
{{- else -}}
|
|
<img src="{{ $src }}" alt="{{ $title }}">
|
|
{{- end -}}
|
|
</a>
|
|
{{ end }}
|
|
{{ if $title }}
|
|
<p class="has-text-centered is-italic has-text-grey-light">{{ $title }}</p>
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}
|
|
</div>
|