format relative path of img element to absolute path