JSON API - replacePlaceholderImage
- addBarcode
- addBookmark
- addBreak
- addCaption
- addChart
- addComment
- addCrossReference
- addDateAndHour
- addDropCap
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addPageNumber
- addRuby
- addSimpleField
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordML
- addWordFragment
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setCompatibilityMode
- setDefaultFont
- setDocumentDefaultStyles
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHTML
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
replacePlaceholderImage
PREMIUM
TRIAL / ADVANCED
Replaces a placeholder within an image by a new image.
Note
You are reading the JSON API documentation. For the PHP API method please go to replacePlaceholderImage.
The placeholder image should be tagged using the alternate text option of the Word interface (this may depend on the Word version).
JSON data
| Key | Description |
|---|---|
| variable | The name of the variable that identifies the placeholder image. |
| src | Path to the local image, Base64 string, or URL. |
| firstMatch | If the variable appears more than once within the Word document and firstMatch is set to true, phpdocx will only replace the first occurrence of the variable within the Word document. |
| hyperlink | If set, adds the image hyperlink (hyperlink or bookmark). |
| replaceShapes | If true, replace images in shapes too. Default as false. |
| target | Possible values are: document, header, footer, footnote, endnote or comment. |
| width |
The value in:
|
| height |
The value in:
|
| dpi | Dots per inch. This parameter is only taken into account if width or height are set to auto. |
| mime | Forces a mime (image/jpg, image/jpeg, image/png, image/gif, image/bmp, image/webp). |
Code samples
Example #1
A template can be a local file, a Base64 string, or a remote file.
Release notes
- phpdocx 18.0:
- new action.
