Forum


Replies: 6   Views: 3898
Getting image captions to work?
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 admin  · 18-01-2016 - 09:04

Hello,

This a simple sample about how to add image captions:

$options = array(
    'src' => 'image.png',
    'imageAlign' => 'left',
    'scaling' => 50,
    'spacingTop' => 10,
    'spacingBottom' => 0,
    'spacingLeft' => 0,
    'spacingRight' => 20,
    'textWrap' => 0,
    'borderStyle' => 'lgDash',
    'borderWidth' => 6,
    'borderColor' => 'FF0000',
    'caption' => array('show_label' => true, 'text' => 'FIRST IMAGE')
);

$docx->addImage($options);

You may read the valid parameters on the addImage API doc (http://www.phpdocx.com/api-documentation/word-content/insert-image-Word-document-with-PHP).

Regards.