Skip to content

Instantly share code, notes, and snippets.

@tristolliday
Last active November 8, 2021 17:37
Show Gist options
  • Select an option

  • Save tristolliday/3755d495e3d01b440f461ba4c2132955 to your computer and use it in GitHub Desktop.

Select an option

Save tristolliday/3755d495e3d01b440f461ba4c2132955 to your computer and use it in GitHub Desktop.
Umbraco 8 Optimised image
@*
Image Processor's WebP plugin must be installed via nuget first.
https://www.nuget.org/packages/ImageProcessor.Plugins.WebP/
*@
<picture>
<source srcset="@Model.Image.GetCropUrl(300, 300, furtherOptions: "&format=webp&quality=80")" type="image/webp">
<img src="@Model.Image.GetCropUrl(300, 300)" width="300" height="300" loading="lazy" alt="@Model.Image.Name" />
</picture>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment