Hello,
The code you are running is setting spacing styles to 0:
'spacingTop' => 0,
'spacingBottom' => 0,
'spacingLeft' => 0,
'spacingRight' => 0,
and the paragraph overlaps the top border. When you open the document with MS Word and do minor change to the image, MS Word changes spacing values (it is removing 0 top and bottom spacings and adding other values).
phpdocx follows the OOXML standard and a 0 value applied to image spacings is valid too (and useful for specific cases). If you want to display the borders in all cases, without being overlapped by other contents, we recommend you apply a non 0 spacing value, for example:
'spacingTop' => 2,
'spacingBottom' => 2,
'spacingLeft' => 0,
'spacingRight' => 0,
Regards.