« Back to Product

Documentation

IPS_GetMediaIDByFile

 int IPS_GetMediaIDByFile (string $MediaPath) 

Parameters

MediaPath

Relative media path as seen from main program path

Returns

ID of the searched media object, otherwise 0

Description

The command returns the ID of the media object with the path MediaPath. If no such object exists, the command returns 0.

Warning

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.

Example

$MediaID = @IPS_GetMediaIDByFile("media\\help.png");
if ($MediaID == 0)
    echo "Picture not found!";
else
    echo "The Media ID is: ". $MediaID;
Any questions?