Documentation
IPS_CreateMedia
int IPS_CreateMedia (int $MediaType)
Parameters
MediaType |
|
Returns
ID of the newly created media object
Description
The command creates an empty media object of the type MediaType.
The function returns an ID that can help to uniquely identified the created media object. After the application the created object is still empty and needs to be connected with the function IPS_SetMediaFile with a real media file.
Example
$ImageFile = "C:\\Pictures\\Alarm_symbol.png"; // Image file
$MediaID = IPS_CreateMedia(1); // create the image in the media pool
IPS_SetMediaFile($MediaID, $ImageFile); // connect the image in the media pool with image file
IPS_SetName($MediaID, "Alarm"); // Name media object
IPS_SetParent($MediaID, 12345); // Sort object to its parent