restructure image upload