Implemented checking for invalid image types