<!--- Set up the target url. ---> <cfset strURL = ( "http://www.tirerack.com/images/wheels/americanracingmuscle/" & "arm_razor_s_s.jpg" ) /> <!--- Set up the base URL folder. This is the folder we will use for the referring location. ---> <cfset strReferrerUrl = GetDirectoryFromPath( strURL ) /> <!--- Grab the image at the given URL. When doing this, we need to grab the image as binary so that we can feed it directly into the CFImage tag. ---> <cfhttp url="#strURL#" method="get" useragent="#CGI.http_user_agent#" getasbinary="yes" result="objGet"> <!--- Spoof the referrer as a header value. This is how we will get around the 403 forbidden access error that is being returned by the server. ---> <cfhttpparam type="header" name="referer" value="#strReferrerUrl#" /> </cfhttp> <!--- ASSERT: If we have made it this far without timming out, then we got are data back from the server. We can not yet be possitive that it worked. ---> <!--- Check to see if the CFHttp grab was successful. ---> <cfif FindNoCase( "200", objGet.StatusCode )> <!--- We have successfully grabbed the image as a binary object. Now, let's read that binary object into a ColdFusion image object. ---> <cfimage action="read" source="#objGet.FileContent#" name="imgTarget" /> <!--- Write the target image to the browser. We could have skipped the above step and just read the binary CFHttp data directly into this tag, but I wanted to demonstrate that you could read it into a ColdFusion image object. ---> <cfimage action="writetobrowser" source="#imgTarget#" format="png" /> <cfelse> <!--- There was a problem with the CFHttp get. ---> <p> There was a problem grabbing the image. </p> <p> Error: <cfset WriteOutput( objGet.StatusCode ) /> </p> </cfif>