Support » Plugin: WP SVG Images » Does not recognize the the viewbox value

  • Resolved ashf

    (@ashf)


    This plugin can not recognize the viewbox value from the SVG like the below.
    SVGs are turned into width:100/height:100.
    Safe SVG plugin can handle it properly.
    <svg width="100%" height="100%" viewBox="0 0 1024 1024"

    • This topic was modified 1 year ago by ashf.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Gerard Blanco

    (@sixaxis)

    Hi @ashf,

    Can you please send us an SVG example where we can see the difference between WP SVG Images and Safe SVG?

    Thank you!

    Thread Starter ashf

    (@ashf)

    Here’s a sample code.
    https://pastebin.com/eNrMGiCN

    Plugin Contributor kubiq

    (@kubiq)

    Currently it’s parsing only float numbers from width and height attributes, because there is no software that outputs anything else than pixels in there, or am I wrong?

    I’m not sure if it’s even valid to use any relative units for svg tag. As far as I know, there should be only specific values/units, like cm or px, otherwise you should use CSS to style it, or simply remove these width and height attributes.

    Thread Starter ashf

    (@ashf)

    Serif Affinity Suite(Affinity Designer) exports 100% for the width/height and it is valid according to the Serif engineer.
    Safe SVG handles it properly.


    Plugin Contributor kubiq

    (@kubiq)

    I guess I can add some condition to simply ignore width and height if there is % unit ofc…

    But it’s a good idea to also optimize your SVG images, because these programs output a lot of not-needed code and the file is often many times bigger than it’s needed, eg. take a look how optimized version of your SVG looks like: https://pastebin.com/8SeMM6Sd

    This can not be done automatically by the plugin, because sometime you don’t want to strip classes, ids, you don’t want to convert everything to paths, etc… so you need to setup good configuration how you need it for each SVG separately, eg. here: https://jakearchibald.github.io/svgomg/

    But sure, I’ll fix this % like I wrote in the first sentence and it will be released in next hours/days.

    Thank you.

    Thread Starter ashf

    (@ashf)

    Thank you

    Plugin Contributor kubiq

    (@kubiq)

    Hello @ashf ,

    you can update to version 4.2 now and everything should work, but it will affect only newly uploaded files after this update, so old ones will be not changed unfortunately.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Does not recognize the the viewbox value’ is closed to new replies.