Open timkelty opened 6 years ago
@andris-sevcenko Probably unrelated, but if you generate a thumb/transform with that tiger.svg
, Craft will produce an invalid SVG, with two height
attributes on the <svg>
tag, because the original SVG already has a height
attribute but no width
.
Even if I manually fix that, Chrome and macOS just show a blank image for the transformed SVGs, which seems like the root issue here.
If you want a thumbnail or any geometry operations performed, you need to have a width/height
attribute pair or a viewBox
attribute.
If you run identify tiger.svg
, you get tiger.svg SVG 0x800 0x800+0+0 16-bit sRGB 100459B 0.020u 0:00.029
If you try to coax ImageMagick into giving you more info than "0x800" with identify -verbose tiger.svg
, you get identify: must specify image size '/var/folders/br/qw4t5tw96b90yqy_vdvv80sc0000gn/T/magick-36009puUk7rSqcvoE' @ error/mvg.c/ReadMVGImage/184.
Theoretically, you could probably analyze the SVG file, trace all the paths and figure out what the real width would be for a height of 800, but let's be real here - that's probably an overkill.
@andris-sevcenko still probably worth looking into why the SVG can be viewed in macOS/Chrome initially, but not after going through our transform process.
SVGs don't always have a height/width attribute. If they don't the thumbnail doesn't seem to work.
Example: tiger.svg.zip