added lqip to picture

pull/647/head
stereobooster 2023-09-13 08:48:48 +02:00
parent 9b64aa8c30
commit 8989f5186a
1 changed files with 9 additions and 1 deletions

View File

@ -22,7 +22,15 @@
{{ $resource = resources.Get ($url.String) }} {{ $resource = resources.Get ($url.String) }}
{{ end }} {{ end }}
{{ with $resource }} {{ with $resource }}
{{ if ne .MediaType.SubType "svg" }}
{{ $lqip := (.Resize "20x webp").Content | base64Encode }}
<picture
style="background: url(data:image/webp;base64,{{ $lqip }}); background-size: cover"
class="{{ $class }}"
>
{{ else }}
<picture> <picture>
{{ end }}
{{ if (and (ne .MediaType.SubType "svg") $webp) }} {{ if (and (ne .MediaType.SubType "svg") $webp) }}
<source <source
{{ if lt .Width 660 }} {{ if lt .Width 660 }}