write image path to db