diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html
index 25448dec..27ff1830 100644
--- a/layouts/shortcodes/gallery.html
+++ b/layouts/shortcodes/gallery.html
@@ -9,7 +9,8 @@
{{- with (.Get "dir") -}}
- {{- $files := readDir (print "/static/" .) }}
+ {{- $dirPath := (print "/static/" .)}}
+ {{- $files := readDir $dirPath }}
{{- range $files -}}
{{- $thumbext := $.Get "thumb" | default "-thumb" }}
@@ -21,15 +22,17 @@
{{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}
{{- $thumbexists := where $files "Name" $thumb }}
{{- $thumbURL := print $baseURL ($.Get "dir") "/" $thumb | absURL }}
+ {{- $imgData := imageConfig (print $dirPath "/" .Name) }}
{{- end }}