As of Version 2.0, AspJpeg can be used to add or replace IPTC values in an image
via the method AddMetadataItem. This method accepts two arguments: an IPTC
tag from the table shown in Section 7.3 above, and a string value
to be inserted under that tag. This method can be called multiple times, if necessary.
To use AddMetadataItem, the property
PreserveMetadata described in the previous section must be set to True before the image
is opened:
<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.PreserveMetadata = True
Jpeg.Open Path
Jpeg.AddMetadataItem "IptcCaption", "New York City Skyline"
Jpeg.AddMetadataItem "IptcCaptionWriter", "John Smith"
...
Jpeg.Save ...
%>
|
All IPTC fields are strings with one exception: the IptcCopyrighted tag introduced in version 2.0
is an on/off flag. Use the string "True" to set this flag or "False" to clear it.
As of Version 2.0.0.1, you can add multiple IptcKeywords entries to an image by using the special
tag "IptcKeywordsAdd". Unlike "IptcKeywords", it adds a new keyword entry instead of replacing
an existing one. For example, the code snippet
Jpeg.AddMetadataItem "IptcKeywordsAdd", "Art"
Jpeg.AddMetadataItem "IptcKeywordsAdd", "Portrait"
adds two keyword entries to an image, "Art" and "Portrait", whereas the snippet
Jpeg.AddMetadataItem "IptcKeywords", "Art"
Jpeg.AddMetadataItem "IptcKeywords", "Portrait"
only adds a single entry, "Portrait" ("Art" is overwritten.)
As of Version 2.1, there is another special tag, "IptcKeywordsRemove",
which removes all keyword entries. In previous versions,
it was not possible to completely remove all existing keywords from an image,
only overwrite (or clear) the last keyword entry while leaving all others intact.
The IptcKeywordsRemove tag is to be used as follows:
Jpeg.AddMetadataItem "IptcKeywordsRemove", ""