fix #10175: restrict image name to String <256 chars
clean up image name determination
remove unnecessarily added import, thanks @manics
fix #10953: image names omit parent directories
remove superfluous suppression
remove superfluous trim()
Merge pull request #1710 from mtbc/trac-10175-long-image-path

fix #10175, #10953: shorten image name