Added getImageFileType function to get the filetype of the image