Images without thumbnails in the uploaded file gallery are all PNG files with MIME type text/plain. All of these also have a malicious code warning displayed on their Image:... page. Perhaps the warning is triggered by the mismatch between file extension and MIME type.
Also, I was unable to upload new PNG files. The wiki would show the error page:
The file is corrupt or has an incorrect extension. Please check the file and upload again.
I found a relevant
MediaWiki FAQ and added the suggested variable
$wgMimeDetectorCommand to our LocalSettings.php.
I can now successfully upload
PNG images, which also get a proper thumbnail in the
upload gallery.
However, this has not helped the previously uploaded PNG images. So far, I have been unable to find an automated fix. If worse comes to worse, or if someone needs to use one of the older images soon, the older images can be downloaded and reuploaded and that should fix them.