SVG Formatter module provides support for using SVG images on your website.
The standard image field in Drupal 8/9/10 doesn't support SVG images. This module adds a new formatter for the file field, which allows files with any extension to be uploaded. In the formatter settings, you can set the default image size and enable alt and title attributes. If you want to add some CSS and Javascript magic to your SVG images, then use the inline SVG option.
You can also use this module in combination with SVG Image module. If that module is installed, you can use the SVG Formatter formatter for the image field.
Installation
Composer
composer require drupal/svg_formatter
Drush
drush en svg_formatter -y
How to use it?
Drupal 8 and SVG images - Blog post describing how to use the module
Screencast: https://youtu.be/ctussLn-2Ck
1. Add a file field to your content type, taxonomy, or any other entity type, and add svg to the allowed file extensions.
2. Go to the 'Manage display' and change the field format to 'SVG Formatter'.
3. Set image dimensions if you want and enable or disable attributes.
Project information
- Module categories: Content Display
- 4,409 sites report using this module
- Created by gnikolovski on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 2.0.x-dev updated 16 Mar 2024 at 07:11 UTC
Development version: 8.x-1.x-dev updated 1 May 2023 at 12:16 UTC