Refactor image parser, update relink image logic

Relink Image Logic updated to check if the original img doesn't exists
and the new img is exists.