Resolution: Won't Do
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?
- We should update our documentation, we don't mention our support for SVGs (https://www.onehippo.org/library/concepts/editor-interface/image-and-asset-upload-validation.html)
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.
- relates to
CMS-10757 SVG images cannot be cropped