cfdocs

isImage

Determines whether a variable returns a ColdFusion image.

isImage(value)
returns boolean

Argument Reference

Name Type Required Default Description
value any Yes   The value that is checked.

Check local file image (Tag)

If the local file is an image, write it to the browser

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

Check online image (Script)

Output whether the online file is an image

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

Expected Result: YES