The form data is POSTed to "showiptc.asp" which uses csASPUpload to extract the uploaded file as well as some other file information. The image data is then passed into the csImageFile component where it is resized and the IPTC text extracted.
Usually the file would then be saved to disk or input into a database but as this is a demonstration using somebody else's image, we have avoided doing this. The file data is stored in a session variable so it can be used later in the script "showiptcimage.asp". This is a technique that should be treated with caution because storing large amounts of data in session variables can use a lot of memory. In this case the image is stored after resizing, and the session variable is reset immediately after use, so there should be no problems. This part of the example is identical to the Upload and Resize example so the description is not repeated here.
Below is some of the code that extracts the IPTC meta data:
<%
If not Image.HasFileInfo Then
Response.Write "No meta data in the image."
Else
Response.Write "<p><b>IPTC text:</b><br>"
If Image.FFO_Caption <> "" Then
Response.Write "Caption: " & Server.HTMLEncode(Image.FFO_Caption) & "<br>"
End If
If Image.FFO_CaptionWriter <> "" Then
Response.Write "Caption Writer: " &_
Server.HTMLEncode(Image.FFO_CaptionWriter) & "<br>"
End If
If Image.FFO_Headline <> "" Then
Response.Write "Headline: " & Server.HTMLEncode(Image.FFO_Headline) & "<br>"
End If
If Image.FFO_DateCreated <> 0 Then
Response.Write "Date Created: " &_
Server.HTMLEncode(Image.FFO_DateCreated) & "<br>"
End If
If Image.FFO_CopyrightFlag = true Then
Response.Write "Copyright Flag: " &_
Server.HTMLEncode(Image.FFO_CopyrightFlag) & "<br>"
End If
If Image.FFO_KeywordsCount > 0 Then
Response.Write "Keywords: "
For I = 0 to Image.FFO_KeywordsCount - 1
Response.Write Image.FFO_Keywords(I) & " "
Next
Response.Write "<br>"
End If
If Image.FFO_SuppCatCount > 0 Then
Response.Write "Supplemental Categories: "
For I = 0 to Image.FFO_SuppCatCount - 1
Response.Write Image.FFO_SuppCat(I) & " "
Next
Response.Write "<br>"
End If
Response.Write "Urgency: " & Image.FFO_Urgency & "</p>"
End If
%>
Each meta data attribute supported has its own property. Most are string values and only the first three are shown here. The Keywords and SupplementalCategories are lists of values and they are displayed by looping through the list.
Click Here to return to the upload form.
© Chestysoft, 2007.