isImageFile

Verifies whether an image file is valid.

isImageFile(value) → returns boolean

Argument Reference

value string
Required

Pathname to an image file.

Examples
Sample code invoking the isImageFile function

If the local file path is for an image, write the image to the browser

<cfset myImage = expandPath("./sample.png")>
<cfif isImageFile(myImage)>
	<cfimage action="writeToBrowser" source="#myImage#">
</cfif>

Output whether the online file is an image

isImageFile("https://cfdocs.org/apple-touch-icon.png");

Expected Result: true

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub