SVG handling and scales in Plone 6

I uploaded an SVG in Plone 6. Then I took TinyMCE and used the image in scale large. Now I got a scale of the SVG delivered. IMO this is pointless, but I may not know why this is needed?
Also the "scale" does not behave correcly. If the scale is large than the pixels set in the SVG, the SVG
got a height of 1.

Overall I would tend to say this is all by accident and SVG should never go through our scaling pipeline? Is it all just about caching and invalidating? Are the size caclulations wrong for SVG + scalings?

SVG is basically a (html?) vector format . I have manually changed sizes of SVGs by editing them with a text editor (since I was sent SVGs in different sizes from a designer). All one need to do is change 'width' and 'height', so theoretically this would be the way to make a scale, I think.

PS: SVG could be a security risk, not sure if 'scaling' could be a problem when 'processing files'

I can edit this manually (I did already with Inkscape). I am not sure if it is enough to change width="...px" height="..px" and keep like viewBox="0 0 400 300"? It seems so.

So this could be done in plone.scale to ensure a size of the image and in fact it is already processed!

It seems it has some issues left, like that it does not upscale SVGs or it ends up with a size of 1.... At least I know now where to debug.

Yes, I think that is enough. I dont think you should edit the other part (I think that is for 'masking', 'cropping without cropping'. You only need to edit those if (for example) the SVG has 'empty parts around it, which is not related to the 'scale')

Looks like its size is read but never changed:

And IMO this is wrong.

Make sure the viewport and the view box have the same width-to-height aspect ratio. Or the ratio between both is the same after scaling.

If not you might need to use preserveAspectRatio="<align> [<meetOrSlice>]" (preserveAspectRatio - SVG: Scalable Vector Graphics | MDN)

1 Like