Préserver les GIF animés lors des transformations d'images
This commit is contained in:
@@ -15,13 +15,21 @@
|
||||
{{- if gt $image.Width $maxWidth -}}
|
||||
{{- $targetWidth = $maxWidth -}}
|
||||
{{- end -}}
|
||||
{{- $display = $image.Resize (printf "%dx webp q80" $targetWidth) -}}
|
||||
{{- $display = partial "media/process-image.html" (dict
|
||||
"image" $image
|
||||
"action" "Resize"
|
||||
"spec" (printf "%dx" $targetWidth)
|
||||
) -}}
|
||||
{{- else -}}
|
||||
{{- $targetHeight := $image.Height -}}
|
||||
{{- if gt $image.Height 900 -}}
|
||||
{{- $targetHeight = 900 -}}
|
||||
{{- end -}}
|
||||
{{- $display = $image.Resize (printf "x%d webp q80" $targetHeight) -}}
|
||||
{{- $display = partial "media/process-image.html" (dict
|
||||
"image" $image
|
||||
"action" "Resize"
|
||||
"spec" (printf "x%d" $targetHeight)
|
||||
) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user