Repository navigation
Resolved #5372 where a watermark image manipulation contaminated the shared source temp file, watermarking auto-generated thumbnails - #5373
Merged
Conversation
When a manipulation's target dimensions exceed the source image in both dimensions, create_thumb() aliased $config['new_image'] onto the single shared temp copy of the source. create_watermark() writes in place, so the watermark was burned into the source that every later manipulation resized from - including the 'thumbs' entry appended last, which sets watermark_id => 0 and should never be watermarked. Copy into the manipulation's own temp file instead. This preserves the existing "copy rather than upsize" behaviour while leaving the shared source untouched.
bryannielsen
approved these changes
Sep 18, 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.
When an upload directory has an image manipulation with a watermark whose target dimensions exceed the uploaded image in both dimensions,
create_thumb()aliases$config['new_image']onto the single shared temp copy of the source (Filemanager.php:1322).create_watermark()sets onlysource_imageand writes in place, so the watermark is burned into the temp file that every subsequent manipulation resizes from — including thethumbsentry appended last, which hardcodeswatermark_id => 0.Result:
_thumbs/and any no-watermark manipulation that also takes the copy-rather-than-upsize path come out watermarked, while the original upload is untouched — which is what makes it easy to miss.This copies into the manipulation's own temp file instead, preserving the existing "copy rather than upsize" behaviour without mutating the shared source.
Verified on a production install: 2,260 of 2,979 images in one upload directory were affected (watermark manipulations at 2000x2000, masters ranging from 200x200 up). After the fix,
_thumbsis clean, a no-watermark copy-path manipulation is byte-identical to its source, and each watermark manipulation contains only its own watermark.Note for reproduction: this requires a fresh upload. Re-syncing an existing file masks it, because pre-existing manipulations are skipped when
$missing_only = true, so nothing contaminates the shared temp copy.Resolves #5372