added check to see if image file is image.