Generates a QR code encoding the given text and returns it as a Binary of encoded image bytes. The module grid is drawn at the largest whole-pixel scale that fits the requested size and then nearest-neighbour resized to hit size on the nose (scaling a QR with a smoothing filter blurs the module edges and can make it unreadable). size is the target edge length in pixels (the result is square, clamped to 16-4096); format is any format the image BIFs write (png, gif, jpg, bmp, webp, ...); errorCorrection is L, M, Q or H; quietZone is the light margin in modules (the QR spec requires 4).
qrCodeGenerate(text [, size [, format [, errorCorrection [, quietZone]]]])
→ returns binary
125pngpnggifjpgbmpwebptifficoMLMQH4Encode a URL and write the 250px PNG to disk.
qr = qrCodeGenerate( "https://example.com/verify", 250, "png" );
imageWrite( qr, expandPath( "/qr.png" ) );
A 125px GIF with H error correction, suitable for printing.
qr = qrCodeGenerate( "ME:12345678", 125, "gif", "H" );
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.