Description

Verifies whether an image file is valid.

Returns

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

Category

Syntax

IsImageFile("path")

See also

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

path

Required. The pathname of the on-disk or in-memory file, or URL, 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 the supported image file formats provided in cfimage. 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>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy