Get a variety of information about an image.
A structure containing the following fields:
| key | value |
|---|---|
| errorCode | 0 for success, non-zero for failure. Always returned, but not really used if the throwOnError option is set to true. |
| errorMessage | A description of the error. Always returned, but not really used if the throwOnError option is set to true. |
| width | the images width in pixels |
| height | the images height, in pixels |
| colorModel | a string representation of the color model |
| sampleModel | a string representation of the sample model |
| imageType | the type of image |
| misc | a (useless) string representation of the image object |
getImageInfo(objImage,inputFile)
| Parameter | Required? | Default | Description |
|---|---|---|---|
| objImage | YES | - | A java image object, or a blank string. |
| inputFile | YES | - | File path or URL to an image, or a blank string. |
You must supply either an image object or a file path to a source image.
<cfset imageCFC = createObject("component","image")>
<cfset imgInfo = imageCFC.getImageInfo("", "C:\Inetpub\wwwroot\myimage.jpg")>
<cfoutput>
Image Dimensions: #imgInfo.width# x #imgInfo.height#
</cfoutput>