optmize the image add & edit & delete function