Forum


Replies: 4   Views: 3187
Error replacing image header
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by wilmar.gonzalez  · 12-07-2016 - 15:52

Hi, im using the "replaceVariableByWordFragment" to replace image on header. This is my code

$imageLogo = new WordFragment($docx, 'defaultHeader');
    $imageOptLogo = array(
        'src' => $aImagenes['Logo_Empresa'],
        'textWrap' => 0,
        'height' => 50,
        'width' => 50,
    );
    $imageLogo->addImage($imageOptLogo);
    $docx->replaceVariableByWordFragment(array('Logo_Empresa' => $imageLogo), array('target' => 'header', 'type' => 'block'));

But when i open the generated file, the image is broken, if i use this image on document it's ok but when i use de header, doesn't work.

Thanks