image path uploaded into database -- code optimized