I have created a new MultimediaComponent and uploaded a SVG image to it. When using this MultimediaComponent in a Component and publish it to my page, the image wont be displayed.

A nullpointer happens in the image resize function at: int sourceW = originalImage.getWidth();

Width and height of a SVG image are not filled because it has no defined width and height - its scale-able. Therefor i think it cant be resized by that function anyways.

So my question is: Is is possible to still use SVG images without changing DXA code? Is there maybe an option to turn the resize feature off completely?

Thank you!

Stack trace if anyone is interested:

ERROR c.s.w.c.controller.PageController - Exception while processing request for: /en/images/logo_tcm1206-369286_w1024_n.svg
java.lang.NullPointerException: null
at com.sdl.webapp.common.util.ImageUtils.resizeImage(ImageUtils.java:30)
at com.sdl.webapp.common.util.ImageUtils.writeToFile(ImageUtils.java:105)
at com.sdl.webapp.tridion.mapping.DefaultContentProvider.getStaticContentFile(DefaultContentProvider.java:95)
at com.sdl.webapp.tridion.mapping.AbstractDefaultContentProvider.getStaticContentFile(AbstractDefaultContentProvider.java:366)
at com.sdl.webapp.tridion.mapping.AbstractDefaultContentProvider.getStaticContent(AbstractDefaultContentProvider.java:309)
at com.sdl.webapp.common.impl.interceptor.StaticContentInterceptor.preHandle(StaticContentInterceptor.java:109)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:914)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

PS: I did also create a ticket in DXA Java GitHub.

  • 1
    This is indeed good question but shame that your question is 1 month old and it got only 29 views (maybe 1 view per day) and no comments except this one, so I am placing bounty of 100 of my own reputations to attract more viewers, readers, writers and answerers so your question will receive more attention. Sep 4, 2017 at 23:07
  • Can you update your question with more details including the syntax used in views to show the SVG image? Sep 7, 2017 at 11:32

2 Answers 2


Perhaps rather than thinking about extending or updating the DXA/DD4T framework - perhaps we can consider this more from the 'content' approach?

Can you set this up so that the SVGs aren't outputted as standard MM components (that DXA is picking up and trying to manipulate?).

I see other issues with SVG throughout SE and perhaps you could look at something creative like pushing it out as a stream of text - see this post for an example.


The error happens only when using the <dxa:media> tag since it will automatically try and add the extension to the multimedia url like this: _w1024_n. However if you try and output the SVG with <img src="${entity.image.url}">, it will work without error since the webapp doesn't try to scale the image.

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.