Script functions reference > Script functions in alphabetical order > G > GetCompCResourceData

GetCompCResourceData
Syntax
GetCompCResourceData(id, $data, replaceMetadata, base64Encode);
id
$data
replaceMetadata
1 – Replace metadata
0 – Do not replace
base64Encode
1 – Base64 encode the resource
0 – Do not base64 encode.
Description
Gets the resource data for the resource specified with the id parameter. The resource data is stored in the $data variable.
For information about other Composition Center resource functions, see Composition Center resource functions.
Example
This example gets the resources and saves images in the working directory. Information for text resources is logged. The metadata used in the resources is replaced with values.
num cnt = getCompCResourceCount( ); 
num i = 0;
while( i < cnt )
{
  GetCompCResourceInfo( i, $id, $name, $contentType, $section );
  i++;
  if( GetCompCResourceData( $id, $data, 1, 0 ) == 1 )
    {
    Log( 0, $data );
    }
  else
    {
    $filename = "./" + $id + ".jpg";//  for jpeg file
    SaveCompCResourceToFile( $id, $filename, 0, 0 );
    }
}
 
OpenText StreamServe 5.6.2 Updated: 2018-01-26