In ./Sources/Subs-Graphics.php if the
createThumbnail function does not successfully a thumbnail file it creates a zero size thumbnail file instead.
However, if a thumbnail is successfully created by the
createThumbnail function it is subsequently renamed by the calling function (ie,
createAttachment in ./Sources/Subs-Post.php or
loadAttachmentContext in ./Sources/Display.php).
The name of the zero size thumbnail file is the the name of the source file plus the suffix
'_thumb' (eg, source file = 186_2d634a9b058ca5f5fe3798a2ba9e6e7bc59ec790, zero size thumbnail file = 186_2d634a9b058ca5f5fe3798a2ba9e6e7bc59ec790_thumb).
Quotefunction createThumbnail($source, $max_width, $max_height)
{
global $modSettings;
$destName = $source . '_thumb.tmp';
// Do the actual resize.
if (!empty($modSettings['attachment_thumb_png']))
$success = resizeImageFile($source, $destName, $max_width, $max_height, 3);
else
$success = resizeImageFile($source, $destName, $max_width, $max_height);
// Okay, we're done with the temporary stuff.
$destName = substr($destName, 0, -4);
if ($success && @rename($destName . '.tmp', $destName))
return true;
else
{
@unlink($destName . '.tmp');
@touch($destName);
return false;
}
}
Also the zero size thumbnail file is not removed when the associated image attachment is deleted because information about the zero size thumbnail file was not added to the
'attachments' table.
I've seen this happen - And this generally happens if the thumbnail creation fails unexpectedly, because of server limitations like memory limits.
Quote from: Aleksi "Lex" Kilpinen on September 17, 2020, 01:48:30 AM
I've seen this happen - And this generally happens if the thumbnail creation fails unexpectedly, because of server limitations like memory limits.
It's easily reproducible in the situation you describe - it doesn't make any sense to me that it even gets created and it bugs me having junk files that never get cleaned up in the attachments directory ...