Skip to content

[GraphQL] Apply the image editable crop to thumbnails - #1178

Merged
fashxp merged 9 commits into
2026.xfrom
fix/997-editable-image-crop
Oct 22, 2026
Merged

fashxp merged 9 commits into
2026.xfrom
fix/997-editable-image-crop

Conversation

@fashxp

@fashxp fashxp commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

What

The area a user selects in a document image editable is now carried on the resolved image and added as a cropPercent item to the thumbnail config, the same way Document\Editable\Image does for the frontend. It affects fullpath/data/srcset/dimensions/resolutions when a thumbnail is requested.

Why

ImageType::image loaded the plain asset and dropped the editable's crop, so GraphQL thumbnails never matched the cropped image of the page. fullpath without thumbnail still 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

  • Unit (Codeception, rerun on ecf002a (merge of 2026.x) in a stub-kernel harness: 10 pass in 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 with cropPercent. The srcset resolutions test fails on the previous revision (the auto name was reloaded as a stored thumbnail).
  • E2E (GraphQL round trip, pimcore-data-hub-997 spec; 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 fix fullpath, srcset (media thumbnail and its resolutions) carry the _auto_ crop name and dimensions is 200x300 instead of 200x150. The cropped thumbnail was fetched and is 200x300.
  • php-cs-fixer clean on the changed files.

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). The resolutions of a srcset entry now follow the requested format (before: original format); also noted there.

Not verified

  • PHPStan (the vendor copy of the helper shadows the changed signature in this environment) and Sonar.
  • Studio editing of the crop (the crop was written to the document by script, not selected in the editor UI).
  • data live, areablock/block-nested image editables, hotspot images.
  • The kernel/DB tests and the CI run on ecf002a (merge of 2026.x, no changes to the fix files) were not run locally.

fashxp and others added 3 commits October 21, 2026 03:18
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>
@fashxp
fashxp changed the base branch from 2026.3 to 2026.x October 21, 2026 10:59
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fashxp
fashxp marked this pull request as ready for review October 21, 2026 19:16
Copilot AI balanced review requested due to automatic review settings October 21, 2026 19:16
@fashxp fashxp self-assigned this Oct 21, 2026
@fashxp fashxp added this to the 2026.4.0 milestone Oct 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread src/GraphQL/Resolver/AssetType.php Resolved
@sonarqubecloud

Copy link
Copy Markdown

@fashxp
fashxp merged commit f747206 into 2026.x Oct 22, 2026
24 checks passed
@fashxp
fashxp deleted the fix/997-editable-image-crop branch October 22, 2026 10:10
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Editable image with user selected specific region not applied to image url received from GraphQL

2 participants