Preview large TXT files fix

Limit the size of the string generating the preview image for TXT files
Merge pull request #11390 from Nemesiz/master

Preview large TXT files fix