4D v13.4

GET PICTURE METADATA

Home

 
4D v13.4
GET PICTURE METADATA

GET PICTURE METADATA 


 

GET PICTURE METADATA ( picture ; metaName ; metaContents {; metaName2 ; metaContents2 ; ... ; metaNameN ; metaContentsN} ) 
Parameter Type   Description
picture  Picture in Picture whose metadata you want to get
metaName  Text in Name or path of block to get
metaContents  Variable in Metadata contents

The GET PICTURE METADATA command can be used to read the contents of the metadata (or meta-tags) found in picture (4D picture field or variable). For more information about metadata, please refer to the description of the SET PICTURE METADATA command.

In the metaName parameter, pass a string specifying the type of metadata to retrieve. You can pass:

  • a constant from the Picture Metadata Names theme containing a tag path,
  • the name of a complete block of metadata ("TIFF", "EXIF", "GPS" or "IPTC"),
  • an empty string ("").

Pass the variable intended to receive the metadata in the metaContents parameter. 

  • If you passed a tag path in metaName, the metaContents parameter will directly contain the value to get. The value will be converted to the type of the variable. Variables of the Text type will be formatted in XML (XMP standard). You can pass an array when the metadata contains more than one value (this is the case, more particularly, for the IPTC Keywords tags).
  • If you passed a block name or an empty string in metaName, the metaContents parameter must be a valid XML DOM element reference. In this case, the contents of the designated block (or all the blocks if you passed an empty string in metaName) is recopied into the element referenced. 

Use of DOM tree structures

 $xml:=DOM Create XML Ref("Root") //Creation of an XML DOM tree
 
  //Reception of TIFF metadata
 $_Xml_TIFF:=DOM Create XML element($xml;"/Root/TIFF")
 GET PICTURE METADATA(vPicture;"TIFF";$_Xml_TIFF)
 
  //Reception of GPS metadata
 $_Xml_GPS:=DOM Create XML element($xml;"/Root/GPS")
 GET PICTURE METADATA(vPicture;"GPS";$_Xml_GPS)

Use of variables

 C_DATE($dateAsDate)
 GET PICTURE METADATA(vPicture;TIFF Date Time;$dateAsDate)
  //only returns the date since $dateAsDate is of the Date type
 
 C_TEXT($dateAsText)
 GET PICTURE METADATA(vPicture;TIFF Date Time;$dateAsText)
  //only returns the date but in XML format
 
 C_INTEGER($urgency)
 GET PICTURE METADATA(vPicture;IPTC Urgency;$urgency)

Reception of tags with multiple values in arrays

 ARRAY TEXT($tTkeywords;0)
 GET PICTURE METADATA(vPicture;IPTC Keywords;$tTkeywords)

After execution of the command, arrTkeywords contains for example:

 $arrTkeywords{1}="France"
 $arrTkeywords{2}="Europe"

Reception of tags with multiple values in a Text variable

 C_TEXT($vTwords;0)
 GET PICTURE METADATA(vPicture;IPTC Keywords;$vTwords)

After execution of the command, vTwords contains for example "France;Europe".

The OK system variable returns 1 if the retrieval of the metadata has proceeded correctly and 0 if an error occurs or if at least one of the tags is not found. In all cases, the any values that can be read are returned.

 
PROPERTIES 

Product: 4D
Theme: Pictures
Number: 1122

The OK variable is changed by the command

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v12

 
SEE ALSO 

GET PICTURE KEYWORDS
Picture Metadata Names
Picture Metadata Values
SET PICTURE METADATA