From d42a00247f712e871806f30ba0e9e56a34d5f5cc Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Mon, 18 Nov 2019 14:15:04 -0500 Subject: [PATCH] image height calculations were wrong --- layouts/shortcodes/codepen.html | 2 +- layouts/shortcodes/image.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/layouts/shortcodes/codepen.html b/layouts/shortcodes/codepen.html index ee58c233..4dbc14b7 100644 --- a/layouts/shortcodes/codepen.html +++ b/layouts/shortcodes/codepen.html @@ -1 +1 @@ - + diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html index 769c6008..b2bd1a73 100644 --- a/layouts/shortcodes/image.html +++ b/layouts/shortcodes/image.html @@ -24,8 +24,9 @@ {{- $image := .Scratch.Get "image" -}} +{{- $origRatio := (div (float $image.Height) $image.Width) }} {{- $displayWidth := $setWidth -}} -{{- $displayHeight := (math.Round (div $image.Height 2)) -}} +{{- $displayHeight := (math.Ceil (mul $origRatio $setWidth)) -}} {{- if .Get "caption" -}}