I had a similar issue. Hosting provider took out all versions of PHP except 8.1 and above. I had 3.1.3 installed (simply because I recorded it; not that the version appears to be hidden in the code base anywhere) and it did not work under 8.1. I checked the 3.1.5 release against the installed 3.1.3 and found few changes. So simply created a new folder with 3.1.5 and movedvar/ over to that new area. And I got similar to the above. The ones not appearing seemed haphazard. Did not seem to be related to permissions or any other settings. I changed the graphic processor from ImageMacick to GD and back. No effect. I rebuilt images (maintenance menu or from the theme) and that did not seem to affect things.
Looking further, I notice that all albums that do not appear have an .htaccess file in them. It seems to have been created about the time of the rebuild. So odd in that this problem was before the first rebuild. The content of that file in every case is:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule (.*) /gallery/index.php?kohana_uri=/file_proxy/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
Order Deny,Allow
Deny from All
</IfModule>
I removed one of the .htaccess files and that folder image thumbnail appeared. As well as all below it. Removed them all in the resizes/, thumbs/ and albums/ folders (only) and everything is back to normal. (note: there are different and important ones in tmp/, uploads/ and logs/)
find var -name .htaccess -print # To see where they exist (not, some are there that need to remain)
find var/{albums,resizes,thumbs} -name .htaccess -exec mv {} {}-old \; # to rename the "bad" ones to .htacess-old and make them ineffective.
# Note: you could use "rm {} \;" for the exec command if you felt comfortable with doing that (deletes instead of renaming the files)
The files do not appear in my backups. Not sure why or when they were added. Suspect during one of the "rebuild images". Most are dated after the last of two rebuilds I forced. Maybe a rebuild was triggered when I first started the code after the overlay. In any case, it fixes the issue.
Now to figure out why HTML code is no longer being processed in album descriptions. But more importantly, likely need to put more focus on migrating away as JR recommends :) Over 28 k entries and every migration script I have found does not take along the description / title fields added to most images. Key being naming people in the photo that most I am not sure about. Others being dates set. Not the EXIF date of when it was scanned. Biggest issue also is I had made mods to allow PDFs, MPG TXT and similar file entries in the older gallery. Still looking for a manager that allows more than just JPGs, PNGs, etc.