optimize getFile function
set thumb format depending on original file extension
Merge pull request #77 from Pathologic/master

optimize getFile function