Dear Ray
Many thanks for having a look. Yes, it is very curious when something works and then doesn't work. When this occurred with my client, I tried to reproduce the problem by uploading and updating various images via his catalog interface. I also looked at the code and compared it with other similar examples.
This one client is the only one who has reported this problem so far. However, I only recently started using the session id for renaming the image files. He is using Windows 10 / Firefox.
When inserting and updating images on my personal catalog, I did not experience the same problem immediately - I added and updated 4 or 5 images - but when I tested using my client's images the problem appeared again after about 8 or 9 uploading/updating sessions. So maybe there is something uniquely strange with the image files. Attached are several of his original images.(See PM)