[BUGFIX] Icons of folder tree of RTE image dialogue are erratic

Solution: Use same logic as for the link dialogue

Resolves: #53259
Release: 6.2
Change-Id: I3c283536895edb849782da7159866992e3d3d051
Reviewed-on: https://review.typo3.org/27346
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland