Make WordPress Core

Opened 9 years ago

Last modified 5 years ago

#31258 reopened defect (bug)

SVG replaced by default image in media library

Reported by: automatic-rock's profile Automatic-rock Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1
Component: Media Keywords: needs-patch
Focuses: ui, administration Cc:


I have enabled svg support for the media library.
In Wordpress 3.9 I could nicely upload an svg file and it would show a thumbnail of the svg image in the media library.
Now I've updated to Wordpress 4.1 and now all the svg files are replaced with a default image and a text stating the title of the svg file.

Although, everything still works (I can still add the svg file and so on), it was very handy to see what the svg file looked like. Is there are reason why this is changed?
Is there something I can do to change it back?

By the way, I've tried this in a fresh new Wordpress install without any other plugins and using a default theme.

Attachments (3)

allow_svg_thumbs_in_media_manager.diff (676 bytes) - added by silb3r 9 years ago.
Allow SVG thumbnails in the Media Manager
wordpress-svg.patch (2.1 KB) - added by LewisCowles 9 years ago.
Patch to fix gallery in grid mode as well as normal view, and to add upload support to core WP
media-template-grid-fix.patch (1.7 KB) - added by LewisCowles 9 years ago.
Fixes Media Grid and Enables uploads viewable in media area of WordPress without enabling SVG support for uploads…

Download all attachments as: .zip

Change History (18)

#1 @SergeyBiryukov
9 years ago

  • Focuses accessibility removed

Confirmed. SVG is displayed correctly in list view (see [29832]), but not in grid view.

Last edited 9 years ago by SergeyBiryukov (previous) (diff)

#2 @Automatic-rock
9 years ago

Maybe unnecessary to mention, but it's the same problem in the media manager (when you want to add an image to a post or page)

#3 @ocean90
9 years ago

As mentioned in the support forums, this is a side effect of #29245 and [29528].

#4 @Automatic-rock
9 years ago

Thanks ocean90,

So the problem is media grid won't display images that don't have data.sizes set.
Maybe an exception should be made for svg, since it can be scaled to any size?

#5 @Kelderic
9 years ago

+1 for the exception for SVG. The format is widely used and will only continue to grow due to it's flexibility on display densities.

#7 @tsquez
9 years ago

@silb3r - the WordPress repository clearly states the following:

Please do not send pull requests. Submit patches to instead.

9 years ago

Allow SVG thumbnails in the Media Manager

#8 @sterlo
9 years ago

This would be nice as it saves me work :)

which is for:

Tangent: have SVG files become supported in core yet?

Last edited 9 years ago by sterlo (previous) (diff)

#9 @SergeyBiryukov
9 years ago

#31973 was marked as a duplicate.

9 years ago

Patch to fix gallery in grid mode as well as normal view, and to add upload support to core WP

#10 @LewisCowles
9 years ago

Check out the patch I submitted to add SVG to core in media upload, grid, regular view etc. It's slightly different to your patch, but it works in IE(edge), FF(edge) & chrome(edge) with no bugs I could see. Also tested on apache php5.4 and nginx php5.5 FPM

9 years ago

Fixes Media Grid and Enables uploads viewable in media area of WordPress without enabling SVG support for uploads...

#11 @LewisCowles
9 years ago

Apparently #24251 deals with adding SVG to the core, so in the interests of adding media support in the media area without augmenting upload, as with the original, but with Grid support, submitted a new patch that does not modify the uploader...

#12 @chriscct7
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Per #24251 WordPress will continue not allowing SVG uploads by default. Therefore, adjusting WordPress to support SVGs internally remains in plugin territory, and as such, closing as invalid.

#13 @Kelderic
9 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Before we close this, could we get some stats from about how many users have any SVG images uploaded on their sites? From browsing the web I see SVG images all over, but I have no hard data on the actual usage. According to, the usages across the entire web is at under 1%, but augmenting this with some WP specific numbers would be helpful.

#14 @helen
9 years ago

  • Milestone set to Awaiting Review

I seriously doubt .com allows SVG uploads. I tried it on my .com site, and it was rejected due to file type.

I think it's fine to leave this open, we should probably make sure list and grid views behave the same way.

#15 @johnbillion
9 years ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.