Things to consider: * Image uploads need to be allowed * Allow it by default? * No image styles for SVGs (only attribute mods)? * Add support for image styles? (later?)

This was addressed in Drupal 8.5.x:

https://www.drupal.org/project/drupal/issues/2541480 https://www.drupal.org/project/drupal/issues/1014816

...and being considered for backporting to D7: https://www.drupal.org/project/drupal/issues/2539478

I found that it's possible to upload SVG images to Drupal 7 (7.38) and they can even be rendered as the original image, but any image styles don't work (obviously since gd doesn't support SVG). Of course there is the imagemagick module that one could try to use and possibly patch, but it didn't seem to work out of box either. I thought that it would be great to add basic SVG support to Drupal core since many browsers support them and they are great for todays world with different screen sizes etc. By basic support I mean that the SVG images would work with styles, not applying the ones that can't be done without gd or similar image manipulation tool, but simply bypassing the styles and applying for example width and height to the img tag directly when theming the images.

...

It would be great if the .ico extension also worked, along with the rest of the image extensions here: https://en.wikipedia.org/wiki/Image_file_formats

There's this contrib module: https://www.drupal.org/project/svg_image

This module changes default image field widget and formatter to allow use SVG image with the standard Image field.

Using SVG Image module you will not have to use another field type to load SVG image. Load SVG files into the Image field, it is not needed to create file field or special "SVG" type field.

Don't forget to add svg file extension into the list of the allowed image extensions in the field settings.

Features (beyond the main functionality):

  • Ability to select width and height of the image in formatter settings
  • Ability to render svg image as or tags.

Trying to upload an .svg file in the "Image" field in the "Post" content type that comes out of the box:

screen shot 2018-05-21 at 3 33 37 pm

GitHub Issue #: 
3136