Repository navigation
[6.x] Fix named transform handles, unsupported asset transforms, and GraphQL immediately - #20594
Merged
riasvdv merged 5 commits intoNov 11, 2026
Merged
Conversation
AssetTransformers now passes the named Image Transform to drivers as AssetTransformRequest::$namedTransform when a definition uses one without overriding its parameters. The craft driver generates and indexes it under its handle, so GraphQL named transforms are stored at _{handle}/ again rather than under a parameter string.
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1c75f-81cb-7691-a8d8-f4023e7fe794
When an asset's transformer throws NotSupportedException, such as for a video in a mixed Assets field, GraphQL transform fields, getUrl() with a transform, and the transform arguments of getWidth(), getHeight(), getFormat() and getMimeType() now return the asset's own values, as in Craft 5, and the exception isn't reported. Asset::transform(), MCP and the transform controller still throw. The legacy Asset overrides the new _runTransform() hook instead of _tryTransform(), so it shares the same fallback. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1c75f-81cb-7691-a8d8-f4023e7fe794
AssetTransformRequest now carries a nullable $immediately, filled from the caller's preference, so drivers decide what to do with it instead of only the craft driver reading the context. withImmediateTransforms(), immediateTransforms() and IMMEDIATE_TRANSFORMS_CONTEXT live on AssetTransformers. CraftAssetTransformDriver keeps its beta.1 method and constant as deprecated forwarders. Legacy image transformers get the value through the request rather than their constructor. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c75f-81cb-7691-a8d8-f4023e7fe794 Co-authored-by: Amp <amp@ampcode.com>
Transform arguments and the @Transform directive accept immediately again. It's removed from the transform definition and runs the transform within AssetTransformers::withImmediateTransforms(), so static builds can get generated transform URLs per query rather than only through the disk's generate_transforms_before_page_load setting. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1c75f-81cb-7691-a8d8-f4023e7fe794
[ci skip] Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a1c75f-81cb-7691-a8d8-f4023e7fe794
Contributor
📚 Storybook previews@craftcms/ui — open Storybook No changed components detected in this Storybook. resources/js — open Storybook No changed components detected in this Storybook. |
brandonkelly
approved these changes
Nov 11, 2026
riasvdv
deleted the
rias/cms-2671-6x-upgrade-discards-the-transform-index-and
branch
November 11, 2026 07:51
timkelty
approved these changes
Nov 11, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes the GraphQL and asset regressions from #20588 for sites upgraded from Craft 5:
AssetTransformerspasses the named transform to drivers asAssetTransformRequest::$namedTransformwhen the definition doesn't override its parameters. Thecraftdriver stores and indexes it under_{handle}.getUrl()with a transform, and the transform arguments ofgetWidth(),getHeight(),getFormat()andgetMimeType()return the asset's own values onNotSupportedException, as in Craft 5, and don't report it.Asset::transform(), MCP and the transform controller still throw.immediatelyis passed to every driver.AssetTransformRequest::$immediately(nullable) carries the caller's preference.withImmediateTransforms(),immediateTransforms()andIMMEDIATE_TRANSFORMS_CONTEXTmove toAssetTransformers, andCraftAssetTransformDriverkeeps its beta.1 method and constant as deprecated forwarders.immediatelyis back as a per-query transform argument.Unchanged on purpose: the upgrade still clears the transform index, because Craft 6 stores transforms under
_{volumeUid}/. craftcms/docs#801 documents how to move Craft 5 transforms there so they're reused.Evidence
Each new test fails without its fix and passes with it:
ImageTransformerTest› keeps named transform handles:f1500and['transform' => 'f1500']index as_f1500; overrides still use the parameter string.Gql/AssetTransformsTest› resolves source values for Assets the transformer can't transform: before, the query returnedNotSupportedException; after, the video's URL, size, format and MIME type.Gql/AssetTransformsTest› generates craft transforms before returning their URLs when requested:immediately: truereturns a URL whose file exists on disk; without it, agenerate-transformURL.AssetTransformersTest› returns the source values for unsupported assets; passes immediate generation requests to drivers (null,true,false).AssetTransformCompatibilityTest› source URL for unsupported assets in native and legacy assets; legacy image transformers getimmediately: true.Related issues