blob: 115da4dbc8cdfb4a71f787026cb1e0ad6fad4901 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
{{ $command := .Get 1 }}
{{ $options := .Get 2 }}
{{ $caption := .Get 3 }}
{{ $source := .Get 4 }}
{{ if eq $command "Fit"}}
{{ $img = $img.Fit $options }}
{{ else if eq $command "Resize"}}
{{ $img = $img.Resize $options }}
{{ else if eq $command "Fill"}}
{{ $img = $img.Fill $options }}
{{ else if eq $command "Crop"}}
{{ $img = $img.Crop $options }}
{{ else }}
{{ errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize."}}
{{ end }}
<figure>
<img class="centered" alt="{{ $caption }}" src="{{ $img.Permalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
<figcaption>
{{ $caption }}
{{- if $source }}
<a href="{{ $source }}" target="_blank" title="source">[source]</a>
{{ end }}
</figcaption>
</figure>
|