Svg support

Hello,

Do you have a bulletproof svg upload method and best practice considering Wordpress(in combination with Beaver Builder plugin)?

I can upload svg’s when using this codesnippet:

function cstm_mime_types( $mimes ){
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
}
add_action( 'upload_mimes', 'cstm_mime_types' );

and preview the svg;s in Wordpress with some injected css:

    img[src$=".svg"],
    td.media-icon img[src$=".svg"],
    img[src$=".svg"].attachment-post-thumbnail,
    #postimagediv img[src$=".svg"] {
      width: 100% !important;
      height: auto !important;
    }

Some issues i encountered when using svg’s with the BB plugin:

1)When using the callout module when uploading an image, i get this error:

<b>Notice</b>: Undefined property: stdClass::$photo_src in /htdocs/wp-content/plugins/bb-plugin/modules/callout/callout.php</b> on line <b>175</b>

2)When i insert svg with the BB photo module nothing happens.

When i insert the svg wih the BB Rich Text modue it does work.

Do you think there is a bulletproof solution or best practice? Or should we just wait until Worpress fully supports svg’s? I really need svg on my sites anno 2015 :wink:

Thanks in advance for your thoughts on this!

Kind regards,
Jorrit

Hey Jorrit,

It sounds like we have a bug somewhere with additional mimes. I’ll make a note to look into a fix for this.

Thanks,
Justin

Hey Jorrit,

I just implemented a fix so the photo field can now support SVG. That will be coming in the next update this evening.

Justin

Hey Justin,

Thank you very much for your reply and great to see that the fix already has been deployed!

Cheers!

You’re welcome!

Justin