Upload SVG as featured image

Community Forums Forums Design Tips and Tricks Upload SVG as featured image

This topic is: not resolved

Tagged: ,

This topic contains 1 reply, has 1 voice, and was last updated by  mommaroodles 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #87704

    mommaroodles
    Member
    Post count: 5

    I recently came across this snippet which allows you to upload svg images – What I want to do is use the svg iamge as a feature image for a post via media uploader and it works on the genesis framework theme and even displays on the front end. the only problem is that it’s not resizing the image.

    Here is the snippet:

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

    and this is what it outputs.

    <img width="1" height="1" itemprop="image" alt="android" class="alignleft post-image entry-image" src="http://localhost/www.wordpress.com/wp-content/uploads/2014/01/android.svg">

    Notice the height and width I’ve been searching for a way to fix this, but have been unsuccessful and was wondering if anyone here might now how to fix this.

    Unfortunately i cant provide an url as I’m working locally.

    #87998

    mommaroodles
    Member
    Post count: 5

    I’ve finally found a way to fix this – awesome now I can upload svg images and use them as featured images :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.