Image not displaying in LibreOffice Writer

I am trying to load an image programmatically on to a LibreOffice Writer .odt document using PHP & XML.

Instead of the image displaying, it is the code that displays. The code is:

$xml = <<<IMG
<draw:frame draw:name="$filenamefromodf" text:anchor-type=“aschar” svg:width="{$width}cm" svg:height="{$height}cm" draw:z-index=“3”>
<draw:image xlink:href=“testpic1.jpg” xlink:type=“simple” xlink:show=“embed” xlink:actuate=“onLoad” draw:mime-type=“image/jpg”/>
</draw:frame>
IMG;

So, what displays is this:

<draw:frame draw:name="167FP1" text:anchor-type="aschar" svg:width="21.168cm" svg:height="15.876cm" draw:z-index="3"> <draw:image xlink:href="testpic1.jpg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:mime-type="image/jpg"/> </draw:frame>

Instead of ‘xlink:href=“testpic1.jpg”’

I have also tried

‘xlink:href=“extracteddestination/Pictures/100000000000002B0000002E30BAD18A830F9794.jpg”’.

But to no avail.

I have also tried replacing the heredoc with outer double quotes and inner escaped double quotes, including trying to echo the image.

I have tried relocating the odt template to the same directory on the server as the calling php script in case there is a path problem.

I have successfully loaded text onto the same .odt template document replacing {placeholders} with values from a MYSQL database. It is only the image that I am having problems with

Version: 7.3.6.2 (x64) / LibreOffice Community
Build ID: c28ca90fd6e1a19e189fc16c05f8f8924961e12e
CPU threads: 2; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: CL

Resultant .odt document illustrating the problem