aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/shortcodes/img.html24
1 files changed, 5 insertions, 19 deletions
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html
index caf9d75..e2a5db9 100644
--- a/layouts/shortcodes/img.html
+++ b/layouts/shortcodes/img.html
@@ -5,30 +5,16 @@
<!-- Get parameters -->
{{- $alt := .Get "alt" | default "" -}}
{{- $caption := .Get "caption" | default "" -}}
-{{- $rotation := .Get "rotation" | default 0 -}}
-
-<!-- Get quality -->
-{{- $quality := .Get "quality" | default "original" -}}
-
-<!-- Apply quality settings -->
-{{- $q := 0 -}}
-{{- $size := 0 -}}
-{{- if eq $quality "low" -}}
- {{- $q = 60 -}}
- {{- $size = 600 -}}
-{{- else if eq $quality "medium" -}}
- {{- $q = 75 -}}
- {{- $size = 1000 -}}
-{{- else if eq $quality "high" -}}
- {{- $q = 90 -}}
- {{- $size = 1200 -}}
-{{- end -}}
+{{- $rotate := .Get "rotate" | default 0 -}}
+{{- $quality := .Get "quality" | default 90 -}}
+{{- $size := .Get "size" | default 1200 -}}
<!-- Make image -->
{{- if ne $quality "original" -}}
- {{- $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) -}}
+ {{- $image = $image.Resize (printf "%dx q%d r%d" $size $quality $rotate) -}}
{{- end -}}
+<!-- TODO add multiple quality/fallback options + webp -->
<figure>
<img src="{{ $image.RelPermalink }}" title="{{ $alt }}" alt="{{ $alt }}" />
{{- if ne $caption "" -}}