Add format param

This commit is contained in:
Will Faught
2023-03-22 22:24:35 -07:00
parent 6350366b7e
commit a47dea8864
5 changed files with 22 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
{{ $crossorigin := $params.crossorigin | default "anonymous" }}
{{ $fetchpriority := $params.fetchpriority }}
{{ $fingerprint := $params.fingerprint | default true }}
{{ $format := $params.format }}
{{ $height := $params.height }}
{{ $loading := $params.loading | default "lazy" }}
{{ $maxheight := $params.maxheight }}
@@ -31,6 +32,11 @@
{{ end }}
{{ with $resource }}
{{ if and (not $method) (not $options) $format }}
{{ $method = "resize" }}
{{ $options = printf "%dx%d %s" $resource.Width $resource.Height $format }}
{{ end }}
{{ if and $method $options }}
{{ if eq $method "crop" }}
{{ $resource = $resource.Crop $options }}