Image
Mostly set props
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x480", alt: "alt of image", width: "640", height: "480", nativeLazyload: true, srcset: [ "https://source.unsplash.com/FV3GConVSss/640x480 1x", "https://source.unsplash.com/FV3GConVSss/1280x960 2x", ], sources: [ { srcset: "https://source.unsplash.com/FV3GConVSss/375x375", media: "(max-width: 375px)", type: "image/webp" }, { srcset: "https://source.unsplash.com/FV3GConVSss/400x400", media: "(min-width: 480px) and (max-width: 999px)", } ] } } %} -
<div class="img"> <picture> <source srcset="https://source.unsplash.com/FV3GConVSss/375x375" type="image/webp" media="(max-width: 375px)"><source srcset="https://source.unsplash.com/FV3GConVSss/400x400" media="(min-width: 480px) and (max-width: 999px)"> <img src="https://source.unsplash.com/FV3GConVSss/640x480" alt="alt of image" width="640" height="480" loading="lazy" draggable="false" srcset="https://source.unsplash.com/FV3GConVSss/640x480 1x, https://source.unsplash.com/FV3GConVSss/1280x960 2x"> </picture> </div>
Native lazyloading
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x480", nativeLazyload: true, } } %} -
<div class="img"> <picture> <img src="https://source.unsplash.com/FV3GConVSss/640x480" alt="" loading="lazy" draggable="false"> </picture> </div>
Srcset
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x480", srcset: [ "https://source.unsplash.com/FV3GConVSss/640x480 1x", "https://source.unsplash.com/FV3GConVSss/1280x960 2x", ] } } %} -
<div class="img"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x480" alt="" draggable="false" srcset="" data-srcset="https://source.unsplash.com/FV3GConVSss/640x480 1x, https://source.unsplash.com/FV3GConVSss/1280x960 2x"> </picture> </div>
set With and height
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x480", alt: "alt of image", width: "640", height: "480", } } %} -
<div class="img"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x480" alt="alt of image" width="640" height="480" draggable="false"> </picture> </div>
With extra class for JS or specific component
-
-
{% include "@Components/img/img.twig" with {props: { extraClass: "i-post__image", src: "https://source.unsplash.com/FV3GConVSss/640x480", alt: "alt of image", width: "640", height: "480", srcset: [ "https://source.unsplash.com/FV3GConVSss/640x480 1x", "https://source.unsplash.com/FV3GConVSss/1280x960 2x", ] } } %} -
<div class="img"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x480" alt="alt of image" width="640" height="480" draggable="false" srcset="" data-srcset="https://source.unsplash.com/FV3GConVSss/640x480 1x, https://source.unsplash.com/FV3GConVSss/1280x960 2x"> </picture> </div>
Ratio 3:2
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x480", ratio: "3-2", } } %} -
<div class="img --ratio-3-2"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x480" alt="" draggable="false"> </picture> </div>
Ratio 4:3
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x480", ratio: "4-3", } } %} -
<div class="img --ratio-4-3"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x480" alt="" draggable="false"> </picture> </div>
Ratio 16:9
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x480", ratio: "16-9", } } %} -
<div class="img --ratio-16-9"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x480" alt="" draggable="false"> </picture> </div>
Ratio 1:1
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x640", ratio: "1-1", } } %} -
<div class="img --ratio-1-1"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x640" alt="" draggable="false"> </picture> </div>
Contain
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x320", ratio: "1-1", objectfit: "contain", isPlaceholder: true, } } %} -
<div class="img --contain --placeholder --ratio-1-1"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x320" alt="" draggable="false"> </picture> </div>
Cover
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x320", ratio: "1-1", objectfit: "cover", isPlaceholder: true, } } %} -
<div class="img --cover --placeholder --ratio-1-1"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x320" alt="" draggable="false"> </picture> </div>
With placeholder
-
-
{% include "@Components/img/img.twig" with {props: { src: "https://source.unsplash.com/FV3GConVSss/640x320", ratio: "1-1", objectfit: "cover", isPlaceholder: true, } } %} -
<div class="img --cover --placeholder --ratio-1-1"> <picture> <img src="" data-src="https://source.unsplash.com/FV3GConVSss/640x320" alt="" draggable="false"> </picture> </div>