blob: 1b524ac804bdd6d8f7098a9d72e277df12a662a0 (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
{{- $source := $.Destination | safeURL -}}
{{- $localPath := print "public/" $source -}}
{{- $remoteImage := resources.GetRemote $source -}}
{{- $width := "" -}}
{{- $height := "" -}}
{{- with $remoteImage -}}
{{- with .Err -}}
{{- if fileExists $localPath -}}
{{- $localImage := imageConfig $localPath -}}
{{- with $localImage -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- end -}}
{{- else -}}
{{- $source = print "/images/thumbnails/placeholder.png" -}}
{{- $localPath = print "static/" $source -}}
{{- $localImage := imageConfig $localPath -}}
{{- with $localImage -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $width = .Width -}}
{{- $height = .Height -}}
{{ end }}
{{ end }}
{{- /* This comment removes trailing newlines. */ -}}
<figure>
<a href="{{ $source }}" onclick="return false;">
<img data-image-zoom
src="{{ $source }}"
alt="{{ $.Text | htmlUnescape }}"
title="{{ $.Text | htmlUnescape }}"
width="{{ $width }}"
height="{{ $height }}"
/>
</a>
{{ if $.Title }}
<figcaption>{{ $.Title | markdownify }}</figcaption>
{{ end -}}
</figure>
{{- /* This comment removes trailing newlines. */ -}}
|