Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-10736

Improvements for our support for SVG image uploads



    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Won't Do
    • 4.2.2
    • None
    • None


      After experimenting with uploading SVG images into the gallery section in the CMS, I've identified the following:

      • The 'original' variant always mentions '0 pixels' for width and height. This is not correct for SVGs that specify widht and height, and it also disables the cropper (luckily since it makes no sense cropping an SVG). If I enable 'upscaling', then the cropper is enabled and this is even more problematic, our cropper doesn't support SVG images. It seems to me that the cropper needs to always be disabled for SVGs.
      • The generated variants have no width and height information if the original SVG doesn't specify width and height. Effectively this is correct, cause this is an SVG that simply doesn't want to specify dimensions. But then why do we generate the variants, isn't it pointless? Should we ignore this and actually do create properly sized variants (by automatically adding width and height attributes)? Or instead, show a warning that we won't create variants cause the uploaded SVG doesn't have dimensions?

      From the closed duplicate ticket (should be considered when resolving this issue):

      There are a few concerns regarding variants created when users upload SVG images and our image cropper.

      The original image reports 0 width and height, so the cropper assumes the target variant dimensions (for any variant) are larger than the size of the original image, and if upscaling is disabled, the cropper is disabled.

      Enabling upscaling leads to more problems, cause then the cropper is enabled but an attempt to crop an svg variant fails with

      ERROR [ImageCropEditorDialog.onOk:324] Unable to create thumbnail image
      INFO org.hippoecm.frontend.plugins.gallery.model.GalleryException: Unsupported MIME type for reading: image/svg+xml
      INFO at org.hippoecm.frontend.plugins.gallery.editor.ImageCropEditorDialog.onOk(ImageCropEditorDialog.java:273)

      The above makes sense if one sees how the cropper looks for svg variants, the cropping mask is 0x0 pixels and not usable.

      What does cropping an svg mean? Since this is not a raster graphics, generating crops probably needs to happen via changing settings in the variant, like width and height, clips and masks.


        Issue Links



              Unassigned Unassigned
              mchatzidakis Minos Chatzidakis
              UX Issues UX Issues
              0 Vote for this issue
              7 Start watching this issue