Updating isImage function to reading first line instead of extention