Last active
December 14, 2015 12:38
-
-
Save richardhughes260/5087455 to your computer and use it in GitHub Desktop.
ColdFusion wrapper for Google Chart API
If you want images to come from your site only and not multiple locations, like when you are using https.
This will accept a URL Parameter for the text and will output the image.
There is no image on the local file system to clean up later.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfparam default="This is Text!!! :)" name="url.text"> | |
<cfhttp | |
method="Get" | |
url="http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl=#url.text#" getAsBinary = "yes" > | |
<!--- From Ben Nadel ---> | |
<!--- Check to see if we found the image. ---> | |
<cfif ( | |
FindNoCase( "200", cfhttp.Statuscode ) AND | |
FindNoCase( "image", cfhttp.Responseheader["Content-Type"] ) | |
)> | |
<!--- We have an image. Now show it! ---> | |
<cfimage source="#cfhttp.filecontent#" action="writeToBrowser"> | |
<cfelse> | |
<!--- Blast! The image didn't come through. ---> | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment