addImage
- getTemplateVariables
- getTemplateVariablesType
- processTemplate
- removeVariableAudio
- removeVariableImage
- removeVariableText
- removeVariableVideo
- replaceVariableAudio
- replaceVariableHtml
- replaceVariableImage
- replaceVariableList
- replaceVariablePptxFragment
- replaceVariableTable
- replaceVariableText
- replaceVariableVideo
- setTemplateSymbol
addImage
BASIC / ADVANCED / PREMIUM
Inserts an image into the PowerPoint presentation.
Description
public addImage($image, $position, $imageStyles = array(), $options = array())
This method inserts images (png, jpg, jpeg, gif, bmp, webp) into the PowerPoint presentation.
Parameters
image
Image path, base64, stream or GdImage.
position
| Key | Type | Description |
|---|---|---|
| coordinateX | int | EMUs (English Metric Unit). |
| coordinateY | int | EMUs (English Metric Unit). |
| sizeX | int | EMUs (English Metric Unit). |
| sizeY | int | EMUs (English Metric Unit). |
| name | string | Internal name. If not set, a random name is generated. |
| order | int | Set the display order. Default after existing contents. 0 is the first order position. If the order position doesn't exist add after existing contents. |
imageStyles
| Key | Type | Description |
|---|---|---|
| border | array |
|
| descr | string | Descr value. |
| hyperlink | string | Hyperlink: external, bookmark (#firstslide, #lastslide, #nextslide, #previousslide) or slide (#slide + position). |
| rotation | int | 60.000ths of a degree. |
| transparency | int | 0 to 100. |
options
| Key | Type | Description |
|---|---|---|
| mime | string | Forces a mime (image/jpg, image/jpeg, image/png, image/gif, image/bmp, image/webp). |
Exceptions
Image doesn't exist.
Image format is not supported.
Mime option is not set and getimagesizefromstring is not available.
Size not valid.
Hyperlink slide position not valid.
Position not valid.
Release notes
- phppptx 4.5:
- transparency option.
- rotation uses 60.000ths of a degree.
- phppptx 4.0:
- removed PHP Warnings when images to be added do not exist.
- phppptx 3.0:
- WebP images.
- GdImage as image source.
- phppptx 1.0:
- new method.