Repository navigation
[GraphQL] Apply the image editable crop to thumbnails - #1178
Merged
Merged
Conversation
The area a user selects in a document image editable is carried on the resolved image and added as cropPercent to the thumbnail config, as the frontend does. Affects fullpath, data, srcset, dimensions and resolutions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…#997) Resolutions are taken from the srcset thumbnail instead of reloading its auto generated name. Helpers made private, tests moved to the resolvers, upgrade note added. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
#997) Adds a test for the ImageType editable crop hand-over, removes the runtime cache entries the resolver test leaves behind, documents that srcset resolutions follow the requested format. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Cropped data requests can process an unnecessary uncropped thumbnail, and changed format propagation lacks regression coverage.
2 open issues
What changed in this PR
Addresses #997 by carrying document image editable crops into GraphQL thumbnails, matching frontend behavior.
Changes:
- Propagates crop metadata and applies it through the shared thumbnail helper.
- Preserves parent thumbnail configuration for srcset resolutions.
- Adds regression tests and documents crop and format compatibility changes.
| File | Description |
|---|---|
| tests/GraphQL/Resolver/AssetTypeEditableCropTest.php | Tests crop application and thumbnail configuration preservation. |
| tests/GraphQL/DocumentElementType/ImageTypeEditableCropTest.php | Tests crop metadata propagation. |
| src/GraphQL/Resolver/AssetType.php | Passes crop metadata through thumbnail resolvers. |
| src/GraphQL/FieldHelper/AssetFieldHelper.php | Applies crops to cloned thumbnail configurations. |
| src/GraphQL/DocumentElementType/ImageType.php | Attaches editable crop metadata to resolved images. |
| doc/01_Installation_and_Upgrade/01_Upgrade_Notes.md | Documents cropping and srcset format changes. |
Review effort: Balanced
…mat (#997) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




What
The area a user selects in a document image editable is now carried on the resolved image and added as a
cropPercentitem to the thumbnail config, the same wayDocument\Editable\Imagedoes for the frontend. It affectsfullpath/data/srcset/dimensions/resolutionswhen athumbnailis requested.Why
ImageType::imageloaded the plain asset and dropped the editable's crop, so GraphQL thumbnails never matched the cropped image of the page.fullpathwithoutthumbnailstill returns the original asset path: the crop is only applied to a requested thumbnail, so existing clients keep their URLs (the frontend also crops without a thumbnail; GraphQL does not).Fixes #997
Verification
tests/GraphQL/Resolver/AssetTypeEditableCropTest.php): fullpath, srcset, the requested format of srcset entries and resolutions, resolutions (srcset entry and image), media configs, crop-specific auto name, stored config untouched.ImageTypeEditableCropTest(3 tests): the editable's crop reaches the descriptor only withcropPercent. The srcset resolutions test fails on the previous revision (the auto name was reloaded as a stored thumbnail).pimcore-data-hub-997spec; green on dev-2026.x with the 2026.x merge 149e314, fails there without the fix; earlier red/green on dev-2026.3): a page with a cropped image editable. On base the thumbnail URL has no crop; with the fixfullpath,srcset(media thumbnail and itsresolutions) carry the_auto_crop name anddimensionsis 200x300 instead of 200x150. The cropped thumbnail was fetched and is 200x300.BC
Clients that already apply the
crop { ... }values to a thumbnail themselves now crop twice. Added to the upgrade notes under 2026.4.0 (GraphQL). Theresolutionsof asrcsetentry now follow the requestedformat(before: original format); also noted there.Not verified
datalive, areablock/block-nested image editables, hotspot images.2026.x, no changes to the fix files) were not run locally.