add save image to local logic