integer IPS_GetMediaIDByName (string $MediaName, integer $ParentID)
|MediaName||Name of the searched media|
|ParentID||ID of the object whose children are searched for the media object|
ID of the found media object, otherwise FALSE
The command is trying to determine the ID of the media called MediaName, whose parent has the ID ParentID. It will use the ID of the first found media whose name matches with MediaName. If such a media was found, its ID is returned, otherwise the command returns FALSE.
Compared to IPS_GetMediaID, this command utilizes an additional criterion (ParentID) for the search. Thus, the probability to find the right ID is increased considerably. However:
As names within IP-Symcon are not unique it is possible that the commands returns a wrong ID.
This function generates a warning if the name was not found. The @ operator can be used to suppress these messages. The exact functionality of this operator is found in the PHP manual.
$MediaID = @IPS_GetMediaIDByName("MyPicture", 12345); if ($MediaID === false) echo "Picture not found!"; else echo "The Media ID is: ". $MediaID;