{{/* Combination of code taken from: https://alexlakatos.com/web/2020/07/17/hugo-image-processing/ & https://dev.to/stereobooster/responsive-images-for-hugo-dn9}} {{/* get file that matches the filename as specified as src="" in shortcode */}} {{ $src := resources.GetMatch (.Get "src") }} {{ if in (.Get "src") "http" }} {{ else }} {{ if in (.Get "src") ".gif" }} {{ else }} {{/* set image sizes, these are hardcoded for now */}} {{ $tinyw := default "500x" }} {{ $smallw := default "800x" }} {{ $mediumw := default "1200x" }} {{ $largew := default "1500x" }} {{/* resize the src image to the given sizes */}} {{ $tiny := $src.Resize $tinyw }} {{ $small := $src.Resize $smallw }} {{ $medium := $src.Resize $mediumw }} {{ $large := $src.Resize $largew }} {{/* add the processed images to the scratch */}} {{/* only use images smaller than or equal to the src (original) image size */}} {{ end }} {{ end }}