Check file is an actual image before trying to generate thumbnail