replaceVariableVideo

replaceVariableVideo

BASIC / ADVANCED / PREMIUM

Replaces video placeholders with new videos.

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

This method replaces video placeholders with new videos.

The video 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 videos 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: video/mp4, video/x-msvideo, video/x-ms-wmv, video/unknown.
target string slides (default), slideLayouts, slideMasters.
Exceptions

Video doesn't exist.

Video 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.