In the previous example we showed how to add metadata to an existing file. In this example we'll retrieve some of the data we saved.

 

   
Setup
 
     

First we'll need a variable containing the URL to our image and another containing the path to the file.

theURL = "images/boat.jpg"
thePath = Server.MapPath(theURL)

   
Getting
 
     

Next we get the metadata back from the image. First we create a File object and open the existing caption metadata. Then we copy the text of the metadata into our title variable.

Set theFile = Server.CreateObject("MetaFiler2.File")
theFile.SetFile(thePath)
Set theMetaData = theFile.Open("title")
theTitle = theMetaData.Text

 

   
Writing
 
     

Finally we write out some HTML to show the image and the title.

Response.Write "<img src=" & theURL & "><br>"
Response.Write Server.HTMLEncode(theTitle)