skip crop on vector graphics thumbnails
Changes in this pull request
SVG Image Thumbnails cannot be cropped if the Thumbnail config uses the original format.
Imagemagick tries to crop the svg and fails with:
ImagickException: delegate failed `'potrace' --svg --output '%o' '%i'' @ error/delegate.c/InvokeDelegate/1924 in /var/www/html/vendor/pimcore/pimcore/lib/Image/Adapter/Imagick.php:262
I fixed it with skipping the crop mechanism on vector graphics if the thumbnail configuration uses the original format.
Steps to reproduce
- create thumbnail config with format = original
- create image editable that uses the thumbnail
- add svg image to editable and crop image to a different size
Additional info
- not sure if we should document this and if yes where
- maybe we have to exclude multiple formats?
- i tried with
isRasterizedSVGbut this produces the same error when Format was original
Review Checklist
- [ ] Target branch (
11.1for bug fixes, others11.x) - [ ] Tests (if it's testable code, there should be a test for it - get help)
- [ ] Docs (every functionality needs to be documented, see here)
- [ ] Migration incl.
install.sql(e.g. if the database schema changes, ...) - [ ] Upgrade notes (deprecations, important information, migration hints, ...)
- [ ] Label
- [ ] Milestone
Quality Gate passed
Kudos, no new issues were introduced!
0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
@jheimbach thank you very much for your PR. Yes, we should add this info to the documentation, I think here would be a good place for it: https://pimcore.com/docs/platform/Pimcore/Documents/Editables/Image#field-specific-image-cropping-for-documents
Additionally I think we have the same issue when using ORIGINAL in combination with vector formats with normal thumbnail definitions, so not in the context of the image editable. In this case pretty much all available transformations are affected I'm afraid.
So I think we should add this information here as well:
https://pimcore.com/docs/platform/Pimcore/Assets/Working_with_Thumbnails/Image_Thumbnails/
And maybe try to just ignore those transformations then 🤔
@jheimbach 🏓 any updates? 😊 Thanks in advance!