update image save to db logic