I've added the SVG file extension for image uploads via admin/structure/types/manage/image/fields/gallery_image, as you see below:

enter image description here

But when I go to upload an image, I'm still not allowed to upload SVG.

enter image description here

I definitely pressed "Save" in the admin page, and I cleared the cache, and I even see the settings as I wanted them in the database, when I inspect the field_config_instance table. There must be some other table or cache that's not updating. Any idea?

4 Answers 4


The Image widget internally allows (and silently enforces post Drupal 6) the use of only the png, gif, jpg and/or jpeg extensions. So, while you can remove an extension from a field, eg, I have removed gif from most of my implementations to avoid anything animated, you can't add any to this list. I would imagine this is because it in itself displays the image after being uploaded and didn't want to break any displays in older IE browsers in the actual form (plus, who knows how image styles would work on them as well :)


You can simply use a file field and implement hook_field_formatter_info_alter in your custom module to enable the "Image" formatter also for file fields. Then you can easily ouput for uploaded SVG as embedded image.

 * Implements hook_field_formatter_info_alter().
function MODULNAME_field_formatter_info_alter(&$info) {
  $info['image']['field types'][] = 'file';

As noted, there's no easy way to simply allow Drupal's core Image module to accept SVG. Instead you can use the contributed module SVG Embed (grudgingly chosen over a filefield for SVG in this discussion) or this sandbox (not officially released) SVG module.

UPDATE: I now recommend svgimg also in Sandbox but likely being released soon. Using it in production, and very happy.


There is also another way around it--using the Media module. Once this is installed, the SVG format can be added at admin/structure/file-types, under image.

If I'm not mistaken, Drupal still doesn't allow SVGs by default due to backwards compatibility concerns (primarily IE8 and below). I've been placing SVGs for some time on projects, though, and have yet to hear a complaint.

  • Not sure if that is the right path, but Media is definitely the way forward with this issue. Commented Sep 11, 2015 at 23:08
  • For the record I created a new type called SVG which is a great way to customize the output and allow you to have a different output for images Commented Feb 23, 2018 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.