OwnCloud fails to display certain JPGs

I have OwnCloud 9.1 on a VPS. It works fine, however, in the gallery I have seen there are some issues with some JPG files. I found that some other users have similar problems, but I found no solution so far and would like to ask whether somebody knows what causes the problem.

I have a folder with a lot of holiday phorographs. Most of them are displayed well (thumbnail as well as preview when clicking on the file), but some are not. When I download the files which are not correctly displayed, I am able to open them in any viewer program (Paint, Photoshop, Gimp, whatever), only ownCloud has problems with these files. I found out that it did not like the capital case JPG extensions, so I renamed all the files to .jpg, and now, some more files are displayed correctly, but still not all of them.

How can I find out what the problem with the JPG images is, and is it possible to fix that somehow?
I don't like this behaviour because it fills the ownCloud log with error messages (imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Invalid SOS parameters for sequential JPEG
at /var/www/html/owncloud/lib/private/legacy/image.php#515).

Hi,

this issue have been reported previously at the bugtracker (https://github.com/owncloud/core/issues/21873) and was fixed for oC 9.0+. If that sill happens please create a new issue to:

Mhhh, it might be also possible that your system doesn't allow the set PHP configuration parameters via ini_set during runtime and so the workaround introduced in that linked issue doesn't work on your system: https://github.com/owncloud/core/pull/21950/files#diff-3267a2e9d16decfe96b1574917f584dbR476