Correctly resize SVG images and handle them in `addImageToTemplate()` (see #7343)