Tuesday, August 28, 2012
Here's a cool application for a QR Code: print it out and include it in a scrapbook or photo album for quick access to media (like video) that can't (yet) be included in a book! Cool, right? So, I needed to find a way to automatically generate the codes in Classic ASP. I found a couple libraries out there, but by far the quickest way is to use Google's Infographics tool.
This comes in really handy especially on my photo search results page, which has long URL strings.
I created a function to create a QR code from any page on this site. I added some logic to build the page string, but still allow the function to be called with any string, but checking for the word "this"function qrCode(strText,intSize) if strText = "this" then strProtocol = "http" strHTTPS = lcase(request.ServerVariables("HTTPS") if strHTTPS <> "off" then strProtocol = "https" strDomain = Request.ServerVariables("SERVER_NAME") strURL = Request.ServerVariables("SCRIPT_NAME") strQueryString = Request.ServerVariables("QUERY_STRING") strText = strProtocol & "://" & strDomain & strURL & "?" & strQueryString end if qrCode = "https://chart.googleapis.com/chart?cht=qr&chs=" & intSize & "x" & intSize & "&chld=L|1&chl=" & server.URLEncode(strText) end function
So to use, I can simply call:qrCode("this",150)1 Comment