Evan Keller Online
Place Holder
   
> home > professional > coldfusion > cf_exif

CF_EXIF

*** REQUIRES COLDFUSION 5 OR HIGHER ***

Download

exif.zip 23.3 KB

Send comments, suggestions and improvements to coldfusion@evankeller.com.

Purchase/Support

CF_EXIF is shareware. You are free to use it for 30 days to evaluate the functionality. If you find it useful, please pay the $10 registration fee. I can only provide technical support to registered users. Payments may be made quickly and conveniently using PayPal. If you would prefer to pay with a check or money order, please send me an e-mail.

About Exif

Exif is a file format used by digital cameras to store information about the picture, such as date, time, camera make and model, as well as camera settings, such as F-stop, aperture, flash, etc. This custom tag will read this information from JPEG files and return it in a structure. For more information about the Exif format see http://www.pima.net/standards/it10/PIMA15740/exif.htm.

Syntax

<CF_EXIF INFILE="full_path_and_file_name.jpg"
	DEBUG="yes" or "no"
	RATIO="yes" or "no"
	RSTRUCT="var_name">

INFILE

Required. Full path to a JPEG image file that contains Exif information.

DEBUG

Optional. If yes, the tag outputs detailed information about its progress. Default is no.

RATIO

Optional. If yes, returns data as a structure with a numerator and a denominator element. If no, returns a decimal value. Default is yes.

RSTRUCT

Optional. Name of the structure to return the results in. Default is "exif".

Usage

This tag is designed to read standard Exif information from JPEG files. The Exif information is returned in a structure. Each Exif tag is returned as a key in the structure. Depending on the type of tag, the value is either a number, a string or, in the case of a ratio, a structure consisting of a numerator and denominator. The file key is a special case. It is a structure that contains information about the file. If the image passed to the custom tag does not contain Exif information, the file key will still be returned with basic file information. Only Exif tags present in the image will be returned in the structure, so it is important to test for the presence of a key before trying to display it.

Tip: Use cfdump to explore the format of the Exif tags. Remember, many manufacturers use different tags for similar information (such as shutter speed and f-stop).

Example

<cf_exif infile="#GetDirectoryFromPath(CGI.CF_TEMPLATE_PATH)#sample.jpg" rstruct="myexifinfo">
<p>
<cfif isDefined("myexifinfo.format")>
	<cfoutput>
		<cfif isDefined("myexifinfo.Make")>
			Make: #myexifinfo.Make#<br>
		</cfif>
		<cfif isDefined("myexifinfo.Model")>
			Model: #myexifinfo.Model#<br>
		</cfif>
		<cfif isDefined("myexifinfo.ExposureTime")>
			Shutter Speed: #myexifinfo.ExposureTime.Numerator#/#myexifinfo.ExposureTime.Denominator#<sup>th</sup><br>
		</cfif>
		<cfif isDefined("myexifinfo.FNumber")>
			Aperture: f #evaluate(myexifinfo.FNumber.Numerator/myexifinfo.FNumber.Denominator)#<br>
		</cfif>
		<cfif isDefined("myexifinfo.Flash")>
			Flash: <cfif myexifinfo.flash is 0>No<cfelse>Yes</cfif><br>
		</cfif>
	</cfoutput>
<cfelse>
	No EXIF information present.
</cfif>
</p>

View Example

Desired Improvements