addAudio

addAudio

BASIC / ADVANCED / PREMIUM

Inserts an audio into the PowerPoint presentation.

Description
public addAudio($audio, $position, $audioStyles = array(), $options = array())

This method inserts audios into the PowerPoint presentation.

Parameters

audio

Audio path. Audio formats: flac, mp3, wav, wma.

position

Key Type Description
new array

A new position is generated.

  • '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) placeholder 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.

audioStyles

Key Type Description
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).
mime string Forces a mime (audio/mpeg, audio/x-wav, audio/x-ms-wma, audio/unknown).
Exceptions

Audio doesn't exist.

Audio format is not supported.

Image doesn't exist.

Image format is not supported.

Position not valid.

Code samples

Example #1

The resulting PPTX looks like:

Release notes
  • phppptx 1.0:
    • new method.