Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 Yesterday 09:44:32

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,481
Website

Re: Invalid SVG?

Bloke wrote #340859:

Viewbox stuff needs looking at. And yes the checks for top/left > 0 would make sense here.

top and left in the viewBox attr. can be negative, it is a <number> The MDN article has examples with negative top and left coordinates. The width and height must be greater than 0.

We could be a little less opinionated on case, perhaps? So we accept nothing forms of viewBox or viewBox? Or does the spec mandate one or the other?

The case sensitivity of the viewbox/viewBox attribute is unclear. The origin of SVG is XML – case sensitive, bu that has been relaxed it seems, but is kept for backwards compatibility. Current browsers can display my SVG file with lowercase viewBox correctly (incl. the now quite old Safari 15.7).

PS – all SVG I use online only specify the viewbox attribute, never specify width and height. Those upload just fine and are correctly managed (thumbnail generation wise)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#14 Yesterday 11:14:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,998
Website GitHub

Re: Invalid SVG?

phiw13 wrote #340861:

top and left in the viewBox attr. can be negative… The width and height must be greater than 0.

Ah okay. Worth knowing, thank you.

all SVG I use online only specify the viewbox attribute, never specify width and height. Those upload just fine and are correctly managed (thumbnail generation wise)

Interesting. Wonder why my ones failed then. Hmmm…

p.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#15 Yesterday 18:16:29

giz
Plugin Author
From: New Zealand
Registered: 2004-07-26
Posts: 390
Website GitHub Twitter

Re: Invalid SVG?

Maybe a bit late, but I find svgomg very useful in prepping svgs.

Offline

#16 Yesterday 22:38:44

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,481
Website

Re: Invalid SVG?

Bloke wrote #340862:

Interesting. Wonder why my ones failed then. Hmmm…

Your Lexmark file “failed” because the non-zero top & left coordinates in the viewBox (viewBox="79 199 1000 198.3"). Current Textpattern code doesn’t seem to like that. (all the SVG files I actually use in Textpattern context always have zero top & left coordinates.)

Is that requirement for zero top & left coordinates a kind of security or validation check before upload?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

Board footer

Powered by FluxBB