Replies: 2   Views: 1166
Add images next to each other
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 Knutsford  · 17-01-2020 - 14:57

How do I add three images next to each other? Thanks

Posted by admin  · 17-01-2020 - 15:45


You need to use WordFragments and an array. For example:


require_once 'classes/CreateDocx.php';

$docx = new CreateDocx();

$imageA = new WordFragment($docx);
$options = array(
    'src' => 'image1.png',
    'scaling' => 40,

$imageB = new WordFragment($docx);
$options = array(
    'src' => 'image2.png',
    'scaling' => 40,

$imageC = new WordFragment($docx);
$options = array(
    'src' => 'image3.png',
    'scaling' => 40,

$runs = array();
$runs[] = $imageA;
$runs[] = $imageB;
$runs[] = $imageC;


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 (

For further information about WordFragments, please check


Posted by Knutsford  · 17-01-2020 - 16:58

Brillant thanks