Copy link to clipboard
Copied
When I took over the care of a CF intranet site, the Google chart API was being used to generate QR codes that are on employee badges; this won't be working for much longer and I need to find a replacement.
No, there are currently no facilities for generating QR codes in ColdFusion. You have to use a third-party QR code generator. Google will show you some, such as CFQRCode.
I found a QR code generator to use, and it has worked great since I added it - until Sunday and not it isn't working. I copied the URL into a browser to make sure that the generator was working and it is, but the codes aren't printing on the badge card.
Addendum: for the sake of rigour, I would add a try/catch to catch errors that arise when the download does not have image content-type
<cftry>
<!--- Convert the binary to an image in ColdFusion --->
<cfimage source="#downloadedBinary#" name="downloadedImage">
<cfif isImage(downloadedImage)>
<!--- Use, preferably, replaceNoCase: think Jpg, JPG, jpg --->
<cfset jpg_to_png=replaceNoCase(BadgPhotoName,'.jpg','.png','all')>
<cfimage action="write" source="#downloadedImage#" destin
...
Copy link to clipboard
Copied
No, there are currently no facilities for generating QR codes in ColdFusion. You have to use a third-party QR code generator. Google will show you some, such as CFQRCode.
Copy link to clipboard
Copied
I found a QR code generator to use, and it has worked great since I added it - until Sunday and not it isn't working. I copied the URL into a browser to make sure that the generator was working and it is, but the codes aren't printing on the badge card.
Copy link to clipboard
Copied
Suggestion as a replacement for the code below the cfhttp tag:
<cfset downloadedBinary=cfhttp.fileContent>
<!--- Convert the binary to an image in ColdFusion --->
<cfimage source="#downloadedBinary#" name="downloadedImage">
<cfif isImage(downloadedImage)>
<!--- Use, preferably, replaceNoCase: think Jpg, JPG, jpg --->
<cfset jpg_to_png=replaceNoCase(BadgPhotoName,'.jpg','.png','all')>
<cfimage action="write" source="#downloadedImage#" destination="c:/workgroups/webdata/badgecards/qr/#jpg_to_png#">
</cfif>
Copy link to clipboard
Copied
Thank you - I'll give that a try.
Copy link to clipboard
Copied
Addendum: for the sake of rigour, I would add a try/catch to catch errors that arise when the download does not have image content-type
<cftry>
<!--- Convert the binary to an image in ColdFusion --->
<cfimage source="#downloadedBinary#" name="downloadedImage">
<cfif isImage(downloadedImage)>
<!--- Use, preferably, replaceNoCase: think Jpg, JPG, jpg --->
<cfset jpg_to_png=replaceNoCase(BadgPhotoName,'.jpg','.png','all')>
<cfimage action="write" source="#downloadedImage#" destination="c:/workgroups/webdata/badgecards/qr/#jpg_to_png#">
</cfif>
<cfcatch type="any">
<!--- Handle any errors --->
</cfcatch>
</cftry>
Copy link to clipboard
Copied
I didn't have any luck with above solutions, but I did figure out a better way to explain what I'm needing to do. I need to generate the QR Code, save it to a folder and then set a variable with the information that I can call from another piece of code. Generate in tst2web and then call the variable from the div starting at line 77 in the tstWhite code.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now