i want my svg

Look, SVG has been the cool graphics format since 2001. And while WordPress now supports a bunch more embed formats, you’d think it’d work. Nope.

Even to upload an SVG file, I have to bypass WordPress’s built in whitelist using PJW Mime Config, and manually add support for image/svg+xml. Otherwise, it’s refused as an insecure file. (All my files are quite well adjusted, I’ll have you know.)

Say if I want to embed this SVG image. I’d probably want to do something like:

<embed type="image/svg+xml" width="100" title="ford_script_fnord-plain" src="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg" />

But this doesn’t end up being what the final code says:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100" height="100" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg" /><embed type="application/x-shockwave-flash" width="100" height="100" src="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg"></embed></object>

If I’d wanted Flash, I’d have asked for it. Do What I Mean, Little Computer!

Update (after the comment below): Okay, last try:

<object type="image/svg+xml" width="220" height="72" title="ford_script_fnord-plain" data="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg" />

Yay, that sorta works – but it doesn’t scale the image. You know what the S in SVG stands for? That’s right – Scalable. Doesn’t seem to allow scaling. Kinda defeats the purpose, doesn’t it?

5 comments

  1. I think the attribute should be ‘data’ rather than ‘src’ in the embed, but it still doesn’t work.

  2. Yeah, what tha Heck.. I thought, I do a fine tabel for benchmarks and this wp-machine creates a big bunch of no-sense-code. Tell, if something happens or You get a solution.

  3. sorry – didnt want to spam here -> object instead of embed do the trick.

    object data=”http://www.phreekz.de/DLS/Tutorials/LBM2_Diag.php” type=”image/svg+xml” width=”500″ height=”550″

    /object

Leave a comment

Your email address will not be published. Required fields are marked *