From 097493f1335c588181c209e25579f5086078dc7e Mon Sep 17 00:00:00 2001 From: Jason Mayo Date: Tue, 25 Aug 2020 08:46:41 +0100 Subject: [PATCH] Added: Ratio container for picture component --- templates/_components/picture.twig | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/templates/_components/picture.twig b/templates/_components/picture.twig index 054df408..7ffb8487 100644 --- a/templates/_components/picture.twig +++ b/templates/_components/picture.twig @@ -11,6 +11,7 @@ @param {string} svgConvertClass @param {string} alt @param {bool} lazy + @param {bool} ratio #} @@ -42,8 +43,9 @@ {# All other image types #} {% set production = craft.app.config.env == 'production' ? true : false %} - {% set lazy = lazy ?? true %} {% set transform = transform ?? [] %} + {% set lazy = lazy ?? true %} + {% set ratio = ratio ?? true %} {% set webp = craft.imager.serverSupportsWebp() and production %} {% set pictureTransform = craft.imager.transformImage( @@ -66,7 +68,14 @@ webp %} - + {% if ratio is defined %} +
+ {% endif %} + + {% if lazy %} {% if webp %} + {% if ratio is defined %} +
+ {% endif %} + {% endif %} {% endif %}