Documentation
IPS_CreateMedia
int IPS_CreateMedia (int $MediaType)
Parameters
| MediaType |
|
Returns
ID of the newly created media object
Description
The function creates an empty media object of the type MediaType.
The function returns an ID that uniquely identifies the created media object. After creation, the object is still empty and needs to be connected to a real media file using the function IPS_SetMediaFile.
Example
// Create a new media object with the name "Alarm"
$ImageFile = "media/Alarm_symbol.png"; // Image file (relative to the IP-Symcon main folder)
$MediaID = IPS_CreateMedia(MEDIATYPE_IMAGE); // create the image in the media pool
IPS_SetMediaFile($MediaID, $ImageFile, true); // connect the image in the media pool with image file
IPS_SetName($MediaID, "Alarm"); // Name media object
IPS_SetParent($MediaID, 12345); // Move media object below the object with the ID "12345"