Skip to content

[3.0] Bail out if thumbnail creation failed to create a file - #9869

Open
jdarwood007 wants to merge 1 commit into
SimpleMachines:release-3.0from
jdarwood007:3.0/fixes8650
Open

jdarwood007 wants to merge 1 commit into
SimpleMachines:release-3.0from
jdarwood007:3.0/fixes8650

Conversation

@jdarwood007

Copy link
Copy Markdown
Member

Fixes #8650

Not really needed as 3.0 is cleanly exiting. But I figure the extra check is worth it.

@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Nov 11, 2026
@albertlast

Copy link
Copy Markdown
Collaborator

This check stops every thumbnail from being made.

$dst_name is already $this->source . '_thumb.tmp' when resize() writes to it, so file_exists($dst_name . '.tmp') looks for …_thumb.tmp.tmp, which never exists. The method then returns false before the rename, and the real …_thumb.tmp is left on disk.

I made a 400×300 PNG and called (new SMF\Graphics\Image($source))->createThumbnail(100, 100):

result files left
release-3.0 SMF\Graphics\Image 100x75 image, image_thumb
this PR false image, image_thumb.tmp

The check would have to be file_exists($dst_name) before the substr(), or file_exists($dst_name . '.tmp') after it.

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.

[2.1]: .tiff issue - thumbnail creation fails, leaving 0-byte file

2 participants