replaceVariableAudio

replaceVariableAudio

BASIC / ADVANCED / PREMIUM

Replaces audio placeholders with new audios.

Description
public replaceVariableAudio($variables, $options = array())

This method replaces audio placeholders with new audios.

The audio placeholder should be tagged using the alternate text option of the PowerPoint interface (this may depend on the PowerPoint version).

Parameters

variables

Array with the names of the placeholder template variables as keys and the audios that should replace them.

options

The possible keys and values of this array are:

Key Type Description
activeSlide bool If true, get only the active slide. Default as false.
image array
  • 'image' (string) image to be used as preview. Set a default one if not set.
  • 'mime' (string) forces a mime (image/jpg, image/jpeg, image/png, image/gif, image/bmp, image/webp).
  • 'usePlaceholderImage' (bool) if true, do not change the placeholder image. Default as false.
mime string Forces a mime: audio/mpeg, audio/x-wav, audio/x-ms-wma, audio/unknown.
target string slides (default), slideLayouts, slideMasters.
Exceptions

Audio doesn't exist.

Audio format is not supported.

Image doesn't exist.

Image format is not supported.

Code samples

Example #1

The resulting PPTX looks like:

Release notes
  • phppptx 3.0:
    • slideLayouts and slideMasters targets.
  • phppptx 1.0:
    • new method.