Effortless Responsive Images with LazySizes and Umbraco
LazySizes.js used in conjunction with ImageProcessor.Web and the built-in Umbraco Image Cropper will make your responsive website's images both adaptive and "retina" quality (if supported by the client browser).
Slimsy includes lazysizes.min.js and picturefill.min.js and some helper methods.
Below is an example of how easy it is to use image srcset with a fallback image using v3 in Umbraco v8
<div class="employee-grid">
@foreach (ContentModels.Person person in Model.Children)
{
<div class="employee-grid__item">
<div class="employee-grid__item__image">
<img src="@Url.GetCropUrl(person.Photo, 323, 300, quality:30, furtherOptions:"&format=auto")"
data-srcset="@Url.GetSrcSetUrls(person.Photo, 323, 300)"
data-src="@Url.GetCropUrl(person.Photo, 323, 300)"
sizes="auto" class="lazyload" />
</div>
</div>
}
</div>
Please visit our GitHub for all the information you need to configure and integrate Slimsy into your website projects.