ImageMetadata.cfc is now available on RIAForge.com. It is a utility used to extract additional metadata than ColdFusion's built-in functions alone. Importantly, it can also set metadata, which is lacking in ColdFusion.

ColdFusion 8.x and up has the built-in functions imageGetIPTCMetadata and imageGetExifMetadata. However, these functions are based on the metadata-extractor by Drew Noakes, and they only return a subset of the total metadata available. Also ColdFusion does not provide a method to set image metadata.

This ImageMetadata.cfc is intended as an enhancement to those functions. It is essentially a wrapper to the ExifTool command line utility by Phil Harvey. The CFC can extract a much wider range of metadata than ColdFusion can alone, and it offers the ability to set metadata. Setting metadata is important because it is common that you would want to set IPTC metadata such as Copyright, Creator, Description, Headline, or Location for example.

The CFC is provided with demonstration usage and the API documentation provided by the CFC Explorer.

The CFC is licensed for use under the Apache License, Version 2.0.

This was tested against Windows 7 and Mac OS X 10.5 against both ColdFusion 8.01 and 9.01.

The CFC requires that you have installed ExifTool to the ColdFusion server.

Additional notes, requirements, usage, and contact info are found in the CFC comments.

Example usage:

view plain print about
1[cfset imageMetaDataUtil = createObject("component","com.stevenerat.util.ImageMetadata").init("/usr/bin/exiftool")><br/><br/>[cfset imageFilePath = getDirectoryFromPath(ExpandPath("*.*")) & "demo_image.jpg"><br/><br/>
2[cfset headline = imageMetaDataUtil.getImageMetadataTag(imageFilePath,"headline")><br/><br/>
3[cfset tags = {}>
4[cfset tags['headline'] = "A NEW HEADLINE">
5[cfset imageMetaDataUtil.setImageMetadata(imageFilePath,tags)>




Go to the ImageMetadata.cfc Project Page


You may also want to review related projects on RIAForge for other ColdFusion image handling enhancements.