Repository navigation
Conversation
Remote image sources are now downloaded when a transform, image editor preview, or index analysis needs them, used, and cleaned up, rather than retained and downscaled. Remove the setting, its fluent setter, and the indexing cache-warming option, with a migration that drops the obsolete session column. The Yii adapter still accepts its legacy cache arguments, and ignores them. Amp-Thread-ID: https://ampcode.com/threads/T-830d6cd5-57a8-4228-a4cd-3665cb1c7013 Co-authored-by: Amp <amp@ampcode.com>
📚 Storybook previews@craftcms/ui — open Storybook No changed components detected in this Storybook. resources/js — open Storybook No changed components detected in this Storybook. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4785570ae3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| app()->terminating(function () use ($imageSourcePath) { | ||
| File::delete($imageSourcePath); | ||
| }); |
There was a problem hiding this comment.
Purge legacy downscaled sources before reusing them
On an upgrade where maxCachedCloudImageSize was positive, imageSourcePath can already contain the old downscaled cache. The freshness check above accepts that file when the remote modification time is unchanged, and this new callback deletes it only after it has been used. Consequently, the first newly requested transform can be generated by upscaling the cached copy rather than reading the original, and that degraded transform is then retained. Delete or otherwise invalidate legacy cached sources before they can be returned; the new previously cached test currently writes a full-size original and therefore does not exercise this upgrade case.
Useful? React with 👍 / 👎.
| app()->terminating(function () use ($imageSourcePath) { | ||
| File::delete($imageSourcePath); | ||
| }); |
There was a problem hiding this comment.
Clean remote sources after each queued transform
When GenerateImageTransform processes remote images through a normal long-running queue:work process, this callback does not run after each job; it waits until the Artisan process exits. Laravel explicitly documents that queue workers are long-lived and retain the booted application state. Because this change now stores full originals rather than size-limited copies, a worker processing many distinct remote assets can accumulate all of those files under the asset-sources directory and exhaust local storage before it restarts. Add per-job cleanup, such as a finally block or queue lifecycle listener, rather than relying solely on application termination.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, but this isn't new in this PR. On 6.x with the default maxCachedCloudImageSize of 0, remote sources are already only deleted when the app terminates. Per-job cleanup is tracked in #20803.
A source cached while maxCachedCloudImageSize was positive may be a downscaled copy, which passed the freshness check, so the first transform after upgrading could upscale it. Amp-Thread-ID: https://ampcode.com/threads/T-830d6cd5-57a8-4228-a4cd-3665cb1c7013 Co-authored-by: Amp <amp@ampcode.com>
Description
maxCachedCloudImageSizeconflates two decisions: whether Craft keeps a local copy of a remote image after using it, and whether it downscales that copy before transforming it. It also silently decides whether the Asset Indexes "Cache remote images" option does anything, since it defaults to0.Stacked on #20547.
Stack meeting notes: https://github.com/craftcms/cms/stack/20789
maxCachedCloudImageSizeand its fluent setter.--cacheRemoteImagesCLI option, with a migration that drops the session column.Sites that set a positive size will download remote originals again for later transforms and image editing.