Getting EXIF Metadata with ColdFusion 8

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).


cfobjective pre-conf training

Related Entries

2 people found this page useful, what do you think?

WAF for CF

Trackbacks

Trackback Address: 657/3783A6B1BE0BBBA0B6684048CFC5334C

Comments

On 10/26/2007 at 9:11:28 AM EDT Steven Erat wrote:
1
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

On 10/26/2007 at 10:34:23 AM EDT Pete Freitag wrote:
2
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.

On 11/16/2007 at 6:27:25 AM EST jyoseph wrote:
3
Wow, great post. I had no idea CF8 had a way to extract EXIF data. Thanks!!

On 10/07/2008 at 3:39:30 PM EDT dan wrote:
4
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?

On 10/08/2008 at 8:23:05 AM EDT Pete Freitag wrote:
5
@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.

On 12/03/2008 at 10:14:28 PM EST Dmitry Yakhnov wrote:
6
Is there any way to remove EXIF data before saving an image? Thumbnail for ~2.5Kb can weight ~205Kb just because of EXIF, which is useless in this case.

On 04/29/2009 at 8:19:45 PM EDT Bjossi wrote:
7
Hi Pete and thanks for this article.

How can I get the Date/Time out of exif? There is no problem e.g. getting the model info like this: <cfoutput> #exif.model# </cfoutput> But where can I get the "name" for all the Date/Time functions?

On 09/11/2009 at 7:31:57 AM EDT Chris Bowyer wrote:
8
<cfoutput> #ImageGetExifTag(img, "Date/Time Original")# </cfoutput>

On 12/16/2009 at 4:36:15 PM EST Joe wrote:
9
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.

Post a Comment




  



Spell Checker by Foundeo

Recent Entries





Basecamp
pfreitag on twitter