Visual FoxPro
Visual FoxPro
Update a String Property in XMP
See more XMP Examples
Demonstrates how to open a JPG or TIF image file, access the XMP metadata, and update the value of a string property. (If the string property does not already exist, it is created.)Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loXmp
LOCAL loXml
lnSuccess = 0
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loXmp = CreateObject('Chilkat.Xmp')
* Load a JPG or TIF image file.
lnSuccess = loXmp.LoadAppFile("qa_data/xmp/AJ_123642_1511.tif")
IF (lnSuccess <> 1) THEN
? loXmp.LastErrorText
RELEASE loXmp
CANCEL
ENDIF
? "Num embedded XMP docs: " + STR(loXmp.NumEmbedded)
* This example assumes that XMP metadata is already present in the image file.
IF (loXmp.NumEmbedded = 0) THEN
? "No XMP metadata already exists.."
RELEASE loXmp
CANCEL
ENDIF
* Get the XMP metadata.
loXml = loXmp.GetEmbedded(0)
* Show the XML:
? loXml.GetXml()
* Update (overwrite) a string property.
loXmp.AddSimpleStr(loXml,"NumberofTimes","123")
lnSuccess = loXmp.SaveAppFile("qa_output/updated.tif")
IF (lnSuccess <> 1) THEN
? loXmp.LastErrorText
RELEASE loXmp
CANCEL
ENDIF
? "Success."
RELEASE loXmp