...
The feature works like this: you append ?mode=thumb to the url of a jpg file.
The thumbnail itself is served as a file. If not available you'll get a 404...
Can you change to If not available then send whole jpg file?
This piece is missing?: I wonder if there is a 3rd party thumbnail generator, which could add thumbnails into the jpgs without re-encoding the original photo data? If that was available and commandline, then @sunday exec thumbgen.bat. Hopefully it could skip jpgs which already contain thumbnail data.
In this case, 'thumbgen.bat' can run multithread by
start "" "my.exe" -c start-minimized=yes -c active=yes
So, hfs, exec doesn't have to wait on it to finish (For Windows 7,8,8+1,10, by using start, then a batch file can end in a couple of milliseconds).