diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-03 10:19:56 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-03 10:19:56 +0100 |
commit | 2aa4c009eec3375f56740f90917f5bee6a72c7f5 (patch) | |
tree | 325b5f12023cf996a8bf9e874508355abfea0026 /docs/layouts | |
parent | 3dd8c1c02646bb28429c106f8cb80f12365e26e4 (diff) | |
parent | eb738cd35cca1ffc68c5ed688dbe2a19108e8761 (diff) |
Merge commit 'eb738cd35cca1ffc68c5ed688dbe2a19108e8761'
Diffstat (limited to 'docs/layouts')
-rw-r--r-- | docs/layouts/shortcodes/imgproc.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/layouts/shortcodes/imgproc.html b/docs/layouts/shortcodes/imgproc.html new file mode 100644 index 000000000..f0ab4c8ea --- /dev/null +++ b/docs/layouts/shortcodes/imgproc.html @@ -0,0 +1,19 @@ +{{ $original := .Page.Resources.GetByPrefix (.Get 0) }} +{{ $command := .Get 1 }} +{{ $options := .Get 2 }} +{{ if eq $command "Fit"}} +{{ .Scratch.Set "image" ($original.Fit $options) }} +{{ else if eq $command "Resize"}} +{{ .Scratch.Set "image" ($original.Resize $options) }} +{{ else if eq $command "Fill"}} +{{ .Scratch.Set "image" ($original.Fill $options) }} +{{ else }} +{{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}} +{{ end }} +{{ $image := .Scratch.Get "image" }} +<figure style="width: {{ add $image.Width 3 }}px; padding: 3px; background-color: #cccc"> + <img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"> + <figcaption> + <small>.{{ $command }} "{{ $options }}"</small> + </figcaption> +</figure>
\ No newline at end of file |