integer IPS_GetMediaIDByFile (string $MediaPath)
MediaPath | Relative media path as seen from main program path |
ID of the searched media object, otherwise 0 |
The command returns the ID of the media object with the path MediaPath. If no such object exists, the command returns 0.
This function generates a warning if the file 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_GetMediaIDByFile("media\\help.png"); if ($MediaID == 0) echo "Picture not found!"; else echo "The Media ID is: ". $MediaID;