adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
730 stars 736 forks source link

AdaptiveImageServlet uses web rendition in case of a fileReference - it should (at least in some cases) use the original #20

Closed henrykuijpers closed 7 years ago

henrykuijpers commented 7 years ago

https://github.com/Adobe-Marketing-Cloud/aem-core-wcm-components/blob/da012e690e33d33051df268233eb92f5d0e11423/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/servlets/AdaptiveImageServlet.java

This servlet uses the web rendition (usually 1280x1280) as the source for the resized image.

This is not correct, as it can happen that we need an image wider than 1280px. This was also a very annoying problem with the ootb adaptive image component in foundation.

Solution: Use the original image

The original image can be very large in size though. A consideration could be to use the original only if an image with a width larger than 1280 is requested. However, you will notice the quality of the 1280 image requested through this servlet is a lot worse than the 1281 image.

raducotescu commented 7 years ago

A web rendition is only used to determine the crop rectangle, if one was defined, or if the requested width corresponds to an already DAM-processed web rendition. Otherwise we always use the original asset to process the image.

The DAM workflow that provides web renditions is configurable, so that a user can provide whatever width they require. I really don't see a need here to always process the original assert, since sometimes this can be a very CPU-intensive process.

oliverlietz commented 6 years ago

@raducotescu, that means cropping of images wider 1280px (web rendition) is broken when default workflows are active, right? That is at least what I've seen so far.

raducotescu commented 6 years ago

Why would the cropping be broken?

oliverlietz commented 6 years ago

The values (coordinates, width and height) for cropping are calculated based on web rendition and written to imageCrop. When original rendition is used in publish (and it's wider than 1280px) these values are not functional of course. A (much) smaller area of the image is rendered. Or is there any setting I'm missing? Can you try with a large image (e.g. QFHD 3840x2160) yourself?