mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Merge commit 'eb738cd35cca1ffc68c5ed688dbe2a19108e8761'
This commit is contained in:
19
docs/layouts/shortcodes/imgproc.html
Normal file
19
docs/layouts/shortcodes/imgproc.html
Normal file
@@ -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>
|
Reference in New Issue
Block a user