Use DOM API to construct image element instead of template.