« Back to Product

Documentation

IPS_GetMedia

 array IPS_GetMedia (int $MediaID) 

Parameters

MediaID

The ID of the media object

Returns

The following information is available as key => value pairs:

Index  Type Description
IsAvailable(up to 3.4) boolean TRUE if media file is available (replaced by MediaIsAvailable since version 4.0)
IsLinked(up to 3.4) boolean TRUE if the file is located outside the Media folder (removed since version 4.0)
LastUpdate(up to 3.4) integer Unix timestamp of last update (replaced by MediaUpdated since version 4.0)
MediaCRC string CRC32 of the file
MediaFile string Path to the file
MediaID integer MediaID
MediaIsAvailable(since 4.0) boolean TRUE if media file is available
MediaIsCached(since 4.0) boolean TRUE if the media object should be kept in memory. See IPS_SetMediaCached
MediaSize integer Size in bytes
MediaType integer Media type
0MEDIATYPE_FORMForm
1MEDIATYPE_IMAGEImage
2MEDIATYPE_SOUNDSound
3MEDIATYPE_STREAMStream
4MEDIATYPE_CHARTChart
5MEDIATYPE_DOCUMENTDocument
MediaUpdated(since 4.0) integer Unix timestamp of last update
SendEvent(up to 3.4) boolean TRUE if automatic file changes should be sent (removed since version 4.0)

Description

The function returns an array with information about the media object with the ID MediaID.

Warning

The previous form of the function that was used up to version 3.4 is accessible as "array IPS_GetMediaCompatibility(integer $MediaID)" since version 4.0 if the corresponding Special Switch is set.

Example

// Since Version 4.0
print_r(IPS_GetMedia(45699));
/* returns e.g.:
Array
(
    [MediaCRC] => E2D2C1D1
    [MediaFile] => media\45699.bin
    [MediaID] => 45699
    [MediaIsAvailable] => 1
    [MediaIsCached] =>
    [MediaSize] => 8192
    [MediaType] => 0
    [MediaUpdated] => 1214421546
)
*/
 
print_r(IPS_GetMediaCompatibility(45699));
/* returns e.g.:
Array
(
    [IsAvailable] => 1
    [IsLinked] =>
    [LastUpdate] => 1214421546
    [MediaCRC] => E2D2C1D1
    [MediaFile] => media\45699.bin
    [MediaID] => 45699
    [MediaSize] => 8192
    [MediaType] => 0
    [SendEvent] =>
)
*/
 
 
 
// Up to Version 3.4
print_r(IPS_GetMedia(45699));
/* returns e.g.:
Array
(
    [IsAvailable] => 1
    [IsLinked] =>
    [LastUpdate] => 1214421546
    [MediaCRC] => E2D2C1D1
    [MediaFile] => media\45699.bin
    [MediaID] => 45699
    [MediaSize] => 8192
    [MediaType] => 0
    [SendEvent] =>
)
*/
Any questions?