How can I embed a svg file into my post or page without using a plugin?
I’ve looked into the apply_filter, but the embeded svg image is not recognized. I’ve also included the mime type for the svg.
Can the WordPress coders please fix the embeding issue in the next release?
1) Make sure you are correctly embedding your SVG’s.
2) Test them in all browsers that you want to support them and then do some research about how SVG’s are rendered and what browers might require some assistance in doing so.
3) This is not a WordPress issue, bug, defect, or deficiency.
Here is some aggregate information on SVG support in various browsers, just for fun. Note the “Native” vs “Plugin” nature of the comparison.
And for your viewing/testing pleasure:
Perhaps I used the wrong terms.
When editing a page I can import images files (jpg, png, …). I would like to do the same thing with svg files. As I understand an svg is an image file according to mime. So Why can I not import an svg file? Somehow when I import an “object” using the wysiwyg editor it thinks I’m trying to embed an flash video. If it is possible I would like to see WordPress support the importation of svg files, just like the other image file formats. I don’t think it is a bug or a deficiency on the part of WordPress. And yes I did include the $mime_types[‘svg’] = ‘image/svg+xml’; in the array through an add_filter function. So maybe the issue rests with how tinymce handles image importation. At this point I just don’t know, I will keep digging into the source code and determine how WordPress handles images, or whether or not I must write another add_filter function to include the proper <object data=”…” >…</object> string code for svg files instead of the default <img src=”…” /> that w
That definitely puts a different perspective on it for me and I have to tell you, I think it’s an excellent question. I’m assuming adding the svg mime type will circumvent any issue with non-allowed file type errors you might encounter if you use the media up-loader for your .svg’s , but as far as how you would get WordPress to recognize that it’s embedding and .svg rather than a flash object… totally over my head I’m afraid. I’m sorry I couldn’t offer anything productive.
I totally agree there is something wrong here.
If I insert something like this in the html editor
<object data="/wp-content/uploads/2011/08/somefile.svg"> <img src="/wp-content/uploads/2011/08/somefile.png" alt="Alt text"/> </object>
then browsers that support SVG will display the SVG file, and those that don’t will display the png version. Granted this won’t work on some very old browsers but I bet more browsers support this than support flash, especially given the proliferation of mobile browsers over the last few years.
That, incidentally, is more or less the way the Wikimedia websites do it.
But here goes, I switch to the wysiwyg tab then back to the html and, oh look, WordPress has re-written my html to download a macromedia object. That’s just plain wrong on two levels:
1) I don’t want to use flash, for the reasons previously explained ie it is NOT universal and it is NOT required for this purpose
2) I thought the whole point of the html editor was that it was for me to write the code, but apparently now WordPress can we-write my html for me, to do something completely different
3) I go edit post, switch to wysiwyg, switch to html, haven’t made any edits whatsoever, and yet wordpress has modified the content!
Did I say 2 levels? Well I stopped counting at 3. Regardless of flash plugins, surely any html I enter manually should be left alone by the wysiwyg editor, unless I edit that particular section explicitly.
- The topic ‘svg embeding’ is closed to new replies.