@@ -32,7 +32,6 @@ the following lines to your ``composer.json``.
3232The following is a basic example of the PHPWord library.
3333
3434``` php
35- // Create a new PHPWord Object
3635$PHPWord = new PHPWord();
3736
3837// Every element you want to append to the word document is placed in a section. So you need a section:
@@ -59,3 +58,35 @@ $myTextElement->setSize(22);
5958$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
6059$objWriter->save('helloWorld.docx');
6160```
61+
62+ ## Image
63+
64+ You can add images easily using the following example.
65+
66+ ``` php
67+ $section = $PHPWord->createSection();
68+ $section->addImage('mars.jpg');
69+ ```
70+
71+ Images settings include:
72+ * `` width `` width in pixels
73+ * `` height `` height in pixels
74+ * `` align `` image alignment, __ left__ , __ right__ or __ center__
75+ * `` marginTop `` top margin in inches, can be negative
76+ * `` marginLeft `` left margin in inches, can be negative
77+ * `` wrappingStyle `` can be inline, __ square__ , __ tight__ , __ behind__ , __ infront__
78+
79+ To add an image with settings, consider the following example.
80+
81+ ``` php
82+ $section->addImage(
83+ 'mars.jpg',
84+ array(
85+ 'width' => 100,
86+ 'height' => 100,
87+ 'marginTop' => -1,
88+ 'marginLeft' => -1,
89+ wrappingStyle => 'behind'
90+ )
91+ );
92+ ```
0 commit comments