Hi, I got an error <$pageResource.Resize>: error calling Resize: *resources.genericResource is not an image while resizing an SVG image, code snippet as follows:
{{ if eq $pageResource.ResourceType "image" }}
{{- $resize := "200x200" -}}
{{- $img = $pageResource.Resize $resize -}}
{{- end -}}
You don’t “resize” SVG images. If the SVG is properly done, it has a box size defined inside of the file. Those define the layout of the image. It has strokes defined and colors and stuff. And then it is “SCALABLE” which is the S in SVG. The rest is and stays text and “resizing” won’t do anything other than visually changing things. Which is not something you do IN the SVG but OUTSIDE of it. That means you put a span or div around it and style that tag to have a certain size and then contain the SVG in it with height: 100% and width: auto.
If the SVG is basically a container for a PNG or GIF image then it’s not a SVG, but an abuse of the format