Documentation
IPS_SetMediaFile
boolean IPS_SetMediaFile (int $MediaID, string $FileName, boolean $FileMustExist)
Parameters
MediaID | ID of the media object |
FileName | Filename/path of the file to link to |
FileMustExist | TRUE, if existence should be checked, otherwise FALSE |
Returns
If the command succeeds, it returns TRUE, otherwise FALSE.
Description
The command binds the file name FileName to the media object with the ID MedienID. If the parameter FileMustExist is set, IP-Symcon checks if the given file exists. The allocated media file must match the media type of the media object.
The file name needs to be unique. If FileName is already bound to another media object, an error is returned
It is absolutely necessary that these files are stored in the main folder "IP-Symcon" or one of its subfolders. Other directories are not possible due to security reasons.
Example
$ImageFile = "Alarm symbol.png"; // Image file
$MediaID = IPS_CreateMedia(1); // create the image in the media pool
IPS_SetMediaFile($MediaID, $ImageFile, true); // bind the image in the media pool with image file