Problem with cfhttp get image QR code

Hi All, i have a problem. I generate external an QR code.
and get the image and save on my server. in the past I use ColdFusion. all was fine.
now I switch to Lucee. but if I get the image it don’t run as an QR code. if I want to scan “error”
if I run the url in cfhttp in the browser I get the image and all is fine.
does anyone knows what I do wrong?
Or have anyone another solution to generate a qrcode on the server, instead external?

Here is my code

<cfhttp
method="Get"
url="https://api.qrserver.com/v1/create-qr-code/?size=350x350&data=BEGIN:VCARD%20%0AVERSION:3.0%20%0AN:Peter; Pan%20%0ATITLE:Manager%20%0ATEL;TYPE=CELL:0221 1224545 %20%0ATEL;TYPE=VOICE,WORK: %20%0ATEL;TYPE=FAX: %20%0AEMAIL;TYPE=WORK:peter@Pan.de%20%0AURL:www.peterpan.de%20%0AADR;TYPE=WORK:;;Ernst-D%C3%nn-Allee 1;Köln;;50554;Germany%20%0AORG:Meister  GmbH%20%0AEND:VCARD" charset=„UTF“-8   getAsBinary = "true" >

        <cfimage source="#cfhttp.filecontent#" destination="#temp_vorschau#/pdf/22222_2.png"  action="write" overwrite="yes">

This image is ok

[type or paste code here](https://api.qrserver.com/v1/create-qr-code/?size=350x350&data=BEGIN:VCARD%20%0AVERSION:3.0%20%0AN:Peter)

Don’t forget to tell us about your stack!

OS: Ubuntu 18
Java Version: 11.0.22 (Eclipse Adoptium) 64bit
Tomcat Version: 9
Lucee Version: 6.0.1.83

I tasted it again. save the good qr image on another server…
and get it. ll is ok…
The error must happen when I transfer the url. Something seems to be going wrong

imho the url is not valid with space characters, it should be urlencoded.
does this work?

<cfset temp_url = "https://api.qrserver.com/v1/create-qr-code/?size=350x350&data=BEGIN:VCARD%20%0AVERSION:3.0%20%0AN:Peter; Pan%20%0ATITLE:Manager%20%0ATEL;TYPE=CELL:0221 1224545 %20%0ATEL;TYPE=VOICE,WORK: %20%0ATEL;TYPE=FAX: %20%0AEMAIL;TYPE=WORK:peter@Pan.de%20%0AURL:www.peterpan.de%20%0AADR;TYPE=WORK:;;Ernst-D%C3%nn-Allee 1;Köln;;50554;Germany%20%0AORG:Meister  GmbH%20%0AEND:VCARD">
<cfset temp_url = URLEncodedFormat(temp_url, "utf-8")>

<cfhttp method="Get" url="#temp_url#" charset="utf-8" getAsBinary = "true" >
<cfimage source="#cfhttp.filecontent#" destination="#temp_vorschau#/pdf/22222_2.png" action="write" overwrite="yes">

Just for completeness, there are also alternatives to create QRCodes locally for your reference, here is an example.

This is also possible with the OSGI compliant library, but I can’t find that post anymore. :confused: I’ll document it as soon as I have some time.

Also if you only need to display QR codes, thus reducing storage space and other server resources, you could use a JavaScript library. There are many available and my choice was QRCode.js. I’ve been using it for several years and it still works perfectly and is supported by cdnjs and jsDelivr.

Awesome! Why not saving the data to a variable and keep the QRGenerator working fully on client-side? Excellent! Thanks @kenricashe for sharing!