You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] autogenerate images are created for every crop variant but dropped from the output #912
FileUtility::processCropVariants() processes every crop variant through FileUtility::process() and passes the full ProcessingConfiguration along, autogenerate included. process() therefore runs processAutogenerate() for each variant and creates a ProcessedFile per configured factor. cropVariant() then assembles the entry from the url and the dimensions only, so the autogenerate keys are dropped.
The images are rendered and stored, but no URL to them ever reaches the payload.
Meanwhile the top level keeps its urlRetina, where it is least useful: with no explicit width/height in the processing configuration, processAutogenerate() clamps the target to the source dimensions (since the fix for #830, to the crop area), so the generated file is pixel-identical to publicUrl — a second ProcessedFile of the same image.
To Reproduce
A CE with an image field whose TCA defines two crop variants, e.g. mobile and desktop
Crop both variants in the backend, then render the page
Look at sys_file_processedfile: one 2x file has been created per crop variant
Look at the JSON: urlRetina is present on the top level only; the cropVariants entries carry publicUrl and dimensions
Expected behavior
Either the autogenerate URLs are carried into the crop variant entries, or they are not generated for crop variants at all. Right now the processing cost is paid and the result is unreachable.
Propagating them seems the more useful of the two: since #830 the per-variant images are clamped to the crop area, so they are correct to expose, and they are exactly what a responsive srcset per breakpoint needs.
A smaller, related point — happy to split it into its own issue: when the computed autogenerate size equals the source size, which is always the case on the top level when no width/height is configured, the generated image is a duplicate. Skipping generation in that case would avoid the extra ProcessedFile.
I am happy to prepare a PR if you would like this fixed — just let me know which of the two directions you prefer, carrying the URLs into the crop variant entries or not generating them there.
Activity