Reading and writing IPTC Text (JPEG metadata) using ASP and csImageFile

This is an example of using the csImageFile component to view and edit JPEG meta data. You will need the csImageFile component installed on your server as well as the sample files, which can be downloaded below. We also have a Cold Fusion version of this example.

Download the sample scripts - fileinfo.zip (43 KB)

Download the trial csImageFile component - csift.zip (4.5 MB)

In this example we show how to read and edit the JPEG IPTC properties of a single JPEG file. The file is hard coded into one of the scripts, so some extension work is necessary to convert this into a complete application for editing any file.

The sample files are listed below. The readme.pdf file contains a description of what each file does and how to make the demo work.

File Description
fileinfo.asp The starting page. This is where the JPG name is specified and the IPTC data is read from it and placed in a form.
update.asp This is the script that processes the form and saves the changes to the IPTC properties.
test.jpg A JPG file containing some meta data.
readme.pdf A description of the application.

The files must all be put in the same directory, which must be web shared with permission to run scripts. The Internet Guest User must have Modify permission on the JPG image.

The HTML formatting is kept to a minimum. A table is used in fileinfo.asp to keep the form items in line, but this should not make the script difficult to follow. The main complications are caused by the Keywords and Supplemental Categories properties because these are lists of strings stored as arrays. The Read Me file provides a full explanation.

You can edit the File Name in "fileinfo.asp" to work a different image. If you want to extend the application to be able to select an image you would need to add an extra page of your own to select the file name and then pass this name to "fileinfo.asp".

In this example, the image is not loaded completely into csImageFile. The meta data is loaded using the ReadMetaData method and after editing it is saved back to the file using OverwriteMetaData. This can increase the speed when working with large files and it prevents degradation of the jpeg image when saving it again.

There are some working examples in our live demonstration area.

For a full list of available ASP demos and tutorials - Click Here.

Cookies

This site uses cookies for functionality, traffic analysis and for targeted advertising. Click the Accept button to accept our Cookie Policy. The Cookie Policy page offers configuration for a reduced set of cookies for this site.