How do I add three images next to each other? Thanks
Hello,
You need to use WordFragments and an array. For example:
<?php
require_once 'classes/CreateDocx.php';
$docx = new CreateDocx();
$imageA = new WordFragment($docx);
$options = array(
'src' => 'image1.png',
'scaling' => 40,
);
$imageA->addImage($options);
$imageB = new WordFragment($docx);
$options = array(
'src' => 'image2.png',
'scaling' => 40,
);
$imageB->addImage($options);
$imageC = new WordFragment($docx);
$options = array(
'src' => 'image3.png',
'scaling' => 40,
);
$imageC->addImage($options);
$runs = array();
$runs[] = $imageA;
$runs[] = $imageB;
$runs[] = $imageC;
$docx->addText($runs);
$docx->createDocx('output');
You can find similar samples that explains how to add inline contents in the same paragraph in all packages (examples/Core/addImage/sample_2.php, examples/Core/addText/sample_3.php) and on the API documentation page (https://www.phpdocx.com/api-documentation/word-content/add-paragraph-text-Word-document-with-PHP).
For further information about WordFragments, please check https://www.phpdocx.com/documentation/practical/wordfragments-and-wordml
Regards.