Added parameter to image save function to allow for deletion of old record