Responsywne obrazy (sizes/srcset) w Evolution CMS
Jeśli szukasz snippetu dla Evolution CMS, który łatwo wygeneruje responsywne obrazy w oparciu o srcset/sizes, to dobrze trafiłeś
srcset to prosty generator srcset/sizes tagu img dla Evolution CMS. Możesz go pobrać tutaj https://github.com/pmfx/evo-srcset
Wywołanie
[ [srcset?
&input=`YourImageGoesHere`
&sizes=`(min-width: 1200px) 1140px,
(min-width: 992px) 940px,
(min-width: 768px) 720px,
calc(100vw - 30px)`
&srcset=`330,546,720,940,1140,1440,1880`
&defaultSize=`1140`
&quality=`80`
&attrAlt=`Image alt text`
&attrClass=`img-responsive`
&attrStyle=`display: inline-block`
&attrCustom=`data-test="success"`
] ]
Wynik
<img sizes="(min-width: 1200px) 1140px,
(min-width: 992px) 940px,
(min-width: 768px) 720px,
calc(100vw - 30px)"
srcset="assets/cache/images/150944-330x-70e.jpg 330w,
assets/cache/images/150944-546x-b43.jpg 546w,
assets/cache/images/150944-720x-33b.jpg 720w,
assets/cache/images/150944-940x-70d.jpg 940w,
assets/cache/images/150944-1140x-6d1.jpg 1140w,
assets/cache/images/150944-1440x-e5d.jpg 1440w,
assets/cache/images/150944-1880x-ef3.jpg 1880w"
src="assets/cache/images/150944-1140x-6d1.jpg"
class="img-responsive"
style="display: inline-block"
alt="Image alt text"
data-test="success">