<cffunction
name="ImageGetUrl"
access="public"
returntype="string"
output="false"
hint="Returns the URL of the temporary image generated from the passed in ColdFusion image object.">
<cfargument
name="Source"
type="any"
required="true"
hint="The ColdFusion image object who's URL we want to get."
/>
<cfargument
name="Format"
type="string"
required="false"
default="png"
hint="The file type of the image we want to use."
/>
<cfset var LOCAL = {} />
<cfsavecontent variable="LOCAL.Output">
<cfimage
action="writetobrowser"
source="#ARGUMENTS.Source#"
format="#ARGUMENTS.Format#"
/>
</cfsavecontent>
<cfset LOCAL.URL = REMatch(
"(?i)src\s*=\s*""[^""]+",
LOCAL.Output
) />
<cfset LOCAL.URL = ListLast( LOCAL.URL[ 1 ], """" ) />
<cfreturn LOCAL.URL />
</cffunction>