Delete the image only if the path is not empty