Update on my blog about Hybris. I’ve added the ability to scale and crop images interactively in hybris. Yes, it’s not out-of-the-box. Strangely enough. And almost everyone needs it.
The process looks like this: the admin uploads a higher resolution image, selects via checkboxes which smaller resolution images need to be created, and adjusts the photo crop if the uploaded image’s proportions do not match the required ones. If after reducing an image to an icon too many important details are lost, the admin can select different scaling settings and crop the image differently for the icon field separately.
This is where the business part ends and the dark forest of technical details begins.
There were several challenges here. Since I used an external and modern plugin for cropping images (http://foliotek.github.io/Croppie/), and the hybris product manager is built on the ZK 3.6.3 framework for one-page application, released seven years ago, where they almost don’t let you do anything with external JavaScript, the task of marrying these different technologies was not easy. I had to put the external JavaScript in a popup, raise the context for the popup in the same extension, and come up with a mechanism for exchanging data with the old ZK (this part is the most unpleasant, as everything has already been thought out in newer versions).
Also, for resizing, I intentionally refused to use imageMagick and other external tools in favor of jScalr, which works well and is also multi-platform.
https://hybrismart.com/2016/08/23/image-crop-resize-in-product-cockpit/
