[BUGFIX] Properly escape the ImageMagick frame selector

The frame selector looks like a glob pattern and gets interpreted as
such by the shell. Currently the generated shell argument is, for
example, 'image.png'[0] which matches a file called image.png0.
Thus, if such a file exists, the wrong argument would be passed to
ImageMagick.

Only if there is no filename that matches the pattern, the string is
correctly passed to ImageMagick (i.e. as-is). But even in that case
there is a performance penalty, because the shell has to scan the whole
directory to check if the file exists. This becomes especially bad if
you're not dealing with a local file system.

By properly escaping the frame selector we stop the shell from
interpreting the glob pattern and both problems get fixed.

Resolves: #31797
Releases: 6.2, 6.1
Change-Id: Ib6dc6556bb9f1d64a0154b0cbe9e253b185c74c2
Reviewed-on: https://review.typo3.org/26711
Reviewed-by: Markus Klein
Tested-by: Markus Klein