Truncate filenames properly

Changes the truncation method for file names so it no longer simply gets the first n letters (and removes the file extension in the process) and instead truncates it like filenameis(...).png (as opposed to filenameisher(...))