Support » Plugin: Safe SVG » Image description and size

  • Resolved fdanielsen


    We’ve been trying out this plugin for SVG support in WordPress, after some issues with another plugin, and this seems to work better.

    However an inconsistency has been discovered which is a bit annoying:

    1. When inserting an SVG from the media library which has an image description defined in the media library, the image description is not inserted with the SVG. Inserting PNGs/JPEGs with image descriptions like this does however. Editing the image and adding an image description for this particular usage does insert the description.

    2. When initially inserting an SVG the <img> tag that gets generated has no width or height attributes, which is fine. But if one edits the image to add the image description as described above, the <img> tag gets width and height attributes set to 2000×2000 (which is the size shown in the size dropdown in the image dialog).

    Why is there a difference with width/height attributes depending on insert vs. edit? And why isn’t the image description inserted with the image initially?

    This site uses a custom built theme by the way, which has no custom hooks that should affect this. The only thing would be some custom image sizes that are defined (but not 2000×2000).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daryll Doyle


    Hi @fdanielsen,

    Thanks for bringing this to my attention.

    R.E. the image description, I will investigate as it’s not something I’ve noticed myself. The plugin doesn’t actually hook in to the actual inserting of an image too much, only to override the size.

    This leads me onto the second issue, if the image isn’t getting the 2000×2000 attributes in initial insert I will fix this as that shouldn’t be the case.
    2000×2000 is set by the plugin as WordPress returns the image size as 0x0 for SVGs so if the size is not overridden the image gets inserted but can’t be seen.

    I’m in the process of trying to work out a way to pull the SVG size from the Viewbox and once I’ve managed that, this 2000×2000 will be replaced with the actual size when possible.

    I’m hoping I’ll be able to find some time to look into these issues this week for you 🙂


    Hi Daryll,

    Thanks for the quick response! So an SVG is supposed to always get width and height set to 2000×2000 currently? Until you are able to read from the viewbox definition of course.

    By the way what I meant wasn’t that width and height was set to 0 when inserting, the attributes are simply not there. Also just grep’ed through my site code and there’s no other place than in your plugin where the get_image_tag is used to override attributes, so a bit strange that the attributes are just lost.

    Looking forward to your findings. Let me know if there’s anything I can do to help!


    Plugin Author Daryll Doyle


    Hi @fdanielsen,

    Sorry for the super late reply, I’ve been busy as of late and struggling to find the time to look at this issue.

    The latest release 1.6.1 should fix the 2000x2000px issue and the image will now use the size chosen when it’s inserted 🙂

    As for the image description, all I was able to find is that “description” doesn’t seem to get inserted but “caption” does. For me this is the same for both SVGs and PNG/JPGs.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image description and size’ is closed to new replies.