summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/image.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes/image.html')
-rw-r--r--layouts/shortcodes/image.html10
1 files changed, 7 insertions, 3 deletions
diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html
index ee2f4a6..4217f39 100644
--- a/layouts/shortcodes/image.html
+++ b/layouts/shortcodes/image.html
@@ -1,12 +1,12 @@
<!-- Read page and image params -->
{{- $max_width := .Page.Params.image_max_width }}
-{{- $dir := .Page.Params.image_dir }}
{{- $caption := .Inner }}
{{- $file := .Params.file }}
{{- $class := .Params.class }}
{{- $source := .Params.source }}
{{- $alt := .Params.alt }}
+{{- $dir := .Page.Params.image_dir }}
<!-- Get the the image -->
{{- $path := printf "%s/%s" $dir $file}}
@@ -22,10 +22,14 @@
{{ end }}
{{- $final2x_width := math.Mul $final1x_width 2}}
+{{ $ext := "jpg" }}
+{{ if eq .Params.transparency "yes" }}
+{{ $ext = "png" }}
+{{ end }}
<!-- Generate 1x and 2x images -->
-{{- $img1xproc := printf "%dx jpg q90" $final1x_width }}
-{{- $img2xproc := printf "%dx jpg q90" $final2x_width }}
+{{- $img1xproc := printf "%dx %s q90" $final1x_width $ext }}
+{{- $img2xproc := printf "%dx %s q90" $final2x_width $ext }}
{{- $img1x := $img.Resize $img1xproc }}
{{- $img2x := $img.Resize $img2xproc }}