Update code of rendering relative image

Update Code of rendering relative image path according to Noah and Su's comments.