[BUGFIX] Also consider JPEG files for IM/GM

The Core does not check for the JPEG file extension
when converting images with IM/GM.

Resolves: #51981
Releases: 6.2, 6.1, 6.0
Change-Id: I148ecb0d3c71fdee563476c33865cd18420b2384
Reviewed-on: https://review.typo3.org/23816
Reviewed-by: Markus Klein
Tested-by: Markus Klein