Legacy Knowledge Base
Published Jul. 2, 2025

Issues With Displaying SVG Files

Written By

Christopher Lui

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

When you upload an .svg image file to Documents & Media, you will not be able to add it into a Web Content while writing or editing a web content. However, you will be able to successfully upload an .svg at the web content image selection screen and it will appear as expected.

Resolution

There are several issues here.

1. There is no thumbnail or preview image generated for SVG files. This is unfortunately a limitation as the SVG file type is not supported by the third party library that the Liferay platform is utilizing: see GitHub Image Metadata Reader.

2. The SVG files are not showing up in the file explorer for Web Content images. This can be resolved by adding image/svg+xml to the following portal property:

dl.file.entry.preview.image.mime.types=image/bmp,image/gif,image/jpeg,image/pjpeg,image/png,image/tiff,image/x-citrix-jpeg,image/x-citrix-png,image/x-ms-bmp,image/x-png,image/x-tiff

Adding the property will at least allow you to select and include .svg images while writing Web Content.

3. Uploading SVG files while trying to create Web Content Structures will fail and you'll receive an error that begins with:

2018-04-18 08:10:28.943 ERROR [http-apr-8080-exec-4][PortletServlet:112] javax.portlet.PortletException: com.liferay.portal.kernel.exception.SystemException: java.io.IOException: Unsupported image type javax.portlet.PortletException: com.liferay.portal.kernel.exception.SystemException: java.io.IOException: Unsupported image type at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:204) at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:418) at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:94) at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:260) at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:71) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:108) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

This error will occur even if you've added SVG files as a valid document file extension. This has been reported in LPS-67171. A workaround is to upload the SVG files to Documents & Media first, then select it as an image in your Web Content Structure. 

Did this article resolve your issue ?

Legacy Knowledge Base