Adobe ColdFusion 8

IsImageFile

Description

Verifies whether an image file is valid.

Returns

True, if the value is a valid image file; False, otherwise.

Category

Image functions

Function syntax

IsImageFile("path")

See also

cfimage, ImageGetBlob, ImageInfo, ImageNew, IsImage

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

path

Required. The pathname of the file to be checked. The pathname can be absolute or relative to the CFM page and must be enclosed in quotation marks.

Usage

Use this function to determine whether an image file is valid. This function returns a False value if the image file format is not supported by the server where ColdFusion is deployed, or if the pathname to the image file is null or invalid.

For a list of standard image file formats supported by ColdFusion, see Supported image file formats. To determine which image file formats are supported on the server where ColdFusion is deployed, use the GetReadableImageFormats and GetWriteableImageFormats.

Example

<!--- Use the IsImageFile function to determine whether an image retrieved from the artwork table in the cfartgallery database is a valid image file. --->
<cfif IsImageFile("images/#artwork.largeImage#")>
    <cfset myImage=ImageNew("images/#artwork.largeImage#")>
    <cfset ImageResize(myImage,50,"")>
    <cfimage action="writeToBrowser" source="#myImage#">
<cfelse>
    <p>I'm sorry, there is no image associated with the title you selected. Please click the Back button and try again.</p>
    </p>
</cfif>