Skip to content

[5.x] Fix storeLocalSource() default destination - #20775

Merged
brandonkelly merged 2 commits into
5.xfrom
fix-store-local-source-5x
Nov 17, 2026
Merged

brandonkelly merged 2 commits into
5.xfrom
fix-store-local-source-5x

Conversation

@timkelty

Copy link
Copy Markdown
Contributor

Description

craft\helpers\ImageTransforms::storeLocalSource() is meant to resize the source file in place when no destination is passed. The default was assigned backwards, so the source path got blanked out and the call did nothing:

 if (!$destination) {
-    $source = $destination;
+    $destination = $source;
 }

Core always passes a destination, so this only affects plugins and other code that leave it out.

When this merges into 6.x, src/helpers/ImageTransforms.php will conflict because the method moved to src/Image/ImageTransformHelper.php (ImageTransformHelper::storeLocalSource()). The same one-line fix needs to go there.

Calling storeLocalSource() without a destination now resizes the source
in place, instead of overwriting the source path with the empty
destination and doing nothing.

Amp-Thread-ID: https://ampcode.com/threads/T-20f1a16b-046e-45e5-8264-23d3d87506c4
Co-authored-by: Amp <amp@ampcode.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 11:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T11:37:27.783533Z 7b19caa PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

🟢 Approval recommended

No active review issues remain for the fix restoring in-place image resizing when no destination is supplied.

No open issues 🎉

What changed in this PR

Fixes ImageTransforms::storeLocalSource() so callers that omit a destination resize the source file in place. Core callers already pass a destination and are unaffected.

Changes:

  • Corrects the default assignment to preserve the source path and use it as the destination.
  • Adds a changelog entry describing the fix.
File Description
src/​helpers/​ImageTransforms.php Defaults the destination to the source path.
CHANGELOG.md Documents the corrected in-place resizing behavior.

Review effort: Balanced

@brandonkelly
brandonkelly merged commit 00a161f into 5.x Nov 17, 2026
13 checks passed
@brandonkelly
brandonkelly deleted the fix-store-local-source-5x branch November 17, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants