Pete Freitag Pete Freitag

Getting EXIF Metadata with ColdFusion 8

Updated on November 17, 2023
By Pete Freitag
coldfusion

One example that I've been meaning to post is how to get Image Metadata using the Exchangeable Image File Format or EXIF a using ColdFusion 8. It's actually quite simple, to get a list of all the EXIF tags simply use the ImageGetExifMetaData function.

Here's a quick example:

<cfimage action="read" source="#ExpandPath("lobster.jpg")#" name="img">
<cfset exif = ImageGetEXIFMetaData(img)>
<cfdump var="#exif#">

Here's a screen shot of a CFDUMP of the EXIF Image Metadata.

EXIF metadata

As you can see some of the useful keys are Model which gives you the digital camera model (Canon EOS DIGITAL REBEL XTi in this example), Make gives you the digital camera brand (Canon), Exposure Time gives you the exposure time (1/60 sec).



coldfusion 8 cfimage exif imagegetexifmetadata cfml examples

Getting EXIF Metadata with ColdFusion 8 was first published on October 26, 2007.

If you like reading about coldfusion 8, cfimage, exif, imagegetexifmetadata, cfml, or examples then you might also like:

Fixinator

The Fixinator Code Security Scanner for ColdFusion & CFML is an easy to use security tool that every CF developer can use. It can also easily integrate into CI for automatic scanning on every commit.


Try Fixinator

CFBreak
The weekly newsletter for the CFML Community


Comments

You should change the Color Space setting on your camera from sRGB to AdobeRGB to capture color differentials at a higher resolution.

http://en.wikipedia.org/wiki/Color_space
by Steven Erat on 10/26/2007 at 9:11:28 AM UTC
Thanks for the Tip Steven! The photo I was using was actually taken by my sister in-law on her camera. I will let her know though.
by Pete Freitag on 10/26/2007 at 10:34:23 AM UTC
Wow, great post. I had no idea CF8 had a way to extract EXIF data. Thanks!!
by jyoseph on 11/16/2007 at 6:27:25 AM UTC
Pete in CF 8.1 I am getting zero data returned. Did they change something or is there something I have to do before playing with ImageGetEXIFMetaData?
by dan on 10/07/2008 at 3:39:30 PM UTC
@Dan - EXIF still works in CF 8.1, not all images provide EXIF data, so that would be the first thing I would check.

Second you might also want to install the hotfix for CF 8.1 as it includes some image manipulation bugs.

If the file does have valid EXIF data, and CF 8.1 can't read it, you should submit a bug to Adobe.
by Pete Freitag on 10/08/2008 at 8:23:05 AM UTC
I have noticed one thing, we use the User Comment field in the EXIF data and with CF8 it comes back as an empty string. CF9 appears to have corrected the issue and returns the contents of the User Comment field. Looks like I'll have to upgrade.
by Joe on 12/16/2009 at 4:36:15 PM UTC