WordPress.org

Ready to get started?Download WordPress

Ideas

Basicr support SVG on media, tinymce and thumbnail

  1. teledirigido
    Member

    Couple a years ago SVG wasn't supported by many browsers but now more than 85% of browsers can display SVG ( http://caniuse.com/svg ).

    I think it would be good to give support on media and also if we could display it properly under the tinymce.

    Today to add a SVG we have to add this filter first:

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

    and then to display it properly we have to add a custom css under with this function

    add_editor_style('custom.css')

    and then add this on the css:

    img { width:100%; height:auto; max-width:100%; }

    Of course this is not a final solution as I'm rewriting the style for every image under the editor style, but at least my SVG is not with 1px by 1px.

    Thanks!

    Posted: 5 months ago #
  2. teledirigido
    Member

    Or using something like this to be fair:

    img[src*="svg"] {
        width:100%;
        max-width:100%;
        height:auto;
    }
    Posted: 5 months ago #
  3. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

    See https://core.trac.wordpress.org/ticket/24251

    Basically there are security risks.

    Posted: 5 months ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    0 Votes
  • Status

    Sorry, not right now