[BUGFIX] IMAGE content object accepts directories

Adds checks for file existence to avoid returning directory
paths instead of path to file.

Resolves: #51781
Releases: master, 6.2
Change-Id: I8f879f38b95e6d9562a8883d35664550d8fa8774
Reviewed-on: http://review.typo3.org/33643
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>