Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-101439

Support thumbnail generation for SVG files in Adaptive Media

    Details

    • Type: Story
    • Status: In Development
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DM > Adaptive Media
    • Labels:
      None

      Description

      If we follow these steps:

      1. Add the mime-type image/svg+xml in Control Panel/Configuration/System Settings/Adaptive Media
      2. Upload a SVG file to Document Library.
      3. Click on the image

      We get this exception:

      2019-09-09 23:16:12.664 WARN  [liferay/adaptive_media_processor-2][AMMessageListener:81] com.liferay.adaptive.media.exception.AMRuntimeException$IOException: java.io.IOException: Unsupported image type
      
      com.liferay.adaptive.media.exception.AMRuntimeException$IOException: java.io.IOException: Unsupported image type
      
              at com.liferay.adaptive.media.image.internal.processor.util.TiffOrientationTransformer.transform(TiffOrientationTransformer.java:57)
      
              at com.liferay.adaptive.media.image.internal.scaler.AMDefaultImageScaler.scaleImage(AMDefaultImageScaler.java:52)
      
              at com.liferay.adaptive.media.image.internal.processor.AMImageProcessorImpl.process(AMImageProcessorImpl.java:123)
      
              at com.liferay.adaptive.media.image.internal.processor.AMImageProcessorImpl.lambda$process$0(AMImageProcessorImpl.java:76)
      
              at java.util.ArrayList.forEach(ArrayList.java:1257)
      
              at com.liferay.adaptive.media.image.internal.processor.AMImageProcessorImpl.process(AMImageProcessorImpl.java:75)
      
              at com.liferay.adaptive.media.image.internal.processor.AMImageProcessorImpl.process(AMImageProcessorImpl.java:43)
      
              at com.liferay.adaptive.media.web.internal.messaging.AMProcessorCommand$2.execute(AMProcessorCommand.java:43)
      
              at com.liferay.adaptive.media.web.internal.messaging.AMMessageListener.doReceive(AMMessageListener.java:77)
      
              at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
      
              at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
      
              at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:52)
      
              at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:752)
      
              at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:664)
      
              at java.lang.Thread.run(Thread.java:748)
      
      Caused by: java.io.IOException: Unsupported image type
      
              at com.liferay.adaptive.media.image.internal.util.RenderedImageUtil.readImage(RenderedImageUtil.java:81)
      
              at com.liferay.adaptive.media.image.internal.processor.util.TiffOrientationTransformer.transform(TiffOrientationTransformer.java:54)
      
              ... 14 more 

      After some analysis, it seems that this happening because we rely on the ImageIO library here:
      https://github.com/liferay/liferay-portal/blob/master/modules/apps/adaptive-media/adaptive-media-image-impl/src/main/java/com/liferay/adaptive/media/image/internal/util/RenderedImageUtil.java#L56

      Which doesn't support SVG:
      https://docs.oracle.com/javase/8/docs/api/javax/imageio/package-summary.html

        Attachments

          Activity

            People

            • Assignee:
              roberto.diaz Roberto Díaz
              Reporter:
              alberto.chaparro Alberto Chaparro
              Recent user:
              Roberto Díaz
              Participants of an Issue:
              Engineering Assignee:
              Roberto Díaz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Packages

                Version Package