KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Save QRCode to a file image #1341

Open Jim Adamek opened this topic on on Mar 10, 2020 - 3 comments

Jim Adamek commented on Mar 10, 2020

The output for QRCode is displayed in view with $report->run()->render(); is output as a canvas image.

Is there a way to request output in a file format that can be saved?

Or second option, is there a way to capture the canvas image so that it can be saved?

Thanks.

David Winterburn commented on Mar 10, 2020

Hi Jim,

The QRCode widget has a property called format which supports "jpg" or "png" image:

QRCode::create(array(
    "format" => "jpg", // "svg", "png", "jpg"

Let us know if it's what you want. Thanks!

Jim Adamek commented on Mar 10, 2020

I am using the script straight out of your documentation and example including "format" => "png", as you described.

Output comes as data:image/png;base64, with a long string of characters that has to be captured in javascript because it is contained in a windows DOM widget, then stripped of the prefix and saved, which I never completely got. In short, if you want to save the image in it's current format, it is a lot of work to convert to a saved file.

Here is the output straight off the PNG on your example page:

<krwidget widget-name='' widget-type='koolreport/barcode/QRCode'><img src='data:image/PNG;base64,iVBORw0KGgoAAAANSUhEUgAAAKoAAACqCAYAAAA9dtSCAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAEVklEQVR4nO3d227jOBRFQXvQ///L6acBBtOJW7ZJkcuqeg5kRtoxc3jT/evr6+sGm/tndQPgCEElQVBJEFQSBJUEQSVBUEkQVBIElYRfR3/wfr/PbMdQIybbHv2+313/2Z+frfK8jt4b36gkCCoJgkqCoJIgqCQcrvrrVlblsyvwKywpHhJUwy8/34Pd2nm7NZ+Xrp8EQSVBUEkQVBKmVf0ji4hCVbtj0fSM3Z/XZYannr15I2/2iEUs9T+Ed+n6SRBUEgSVBEEl4TLF1O5V7X9dvXD6jm9UEgSVBEElQVBJEFQSBJWEywxPvbIC/5lhqNlrCa4+ZOUblQRBJUFQSRBUEi5TTI0qRkprBj7JtKB6CGPNvp+7Py9dPwmCSoKgkiCoJAwppj51em/27/XT9We/I6D4vC4zPPXI7H339um/T9dPgqCSIKgkCCoJiqnb84XN7J/nT4eDuvtc8N+cccb+Tq+erD+v/9P1kyCoJAgqCYJKwuFiamXl+qlTkLN3Hew2NfxOgWd46oHd/kB2a8+ZdP0kCCoJgkqCoJKQKKZWFQxXm9NfsaPh6EjA23P9s+eyz1g5v9OwzOywrDrV8N3fS9dPgqCSIKgkCCoJibn+n+zYpu+sOknwmTUAI9syY9H2kOGpFSvVdwtppZ2rvJsRXT8JgkqCoJIgqCQsOc1vp23Fo5SKplJb/5VYlPKd3d7EN/taZ6wlWHV/jtD1kyCoJAgqCYJKwv3r4H/FxUpxllULtj/x+sNX+L9i1Vn3V97//ql0/SQIKgmCSoKgkjC1mFq1L75SOFXauYNpK/x33Bc/83M/+TWPOywK0vWTIKgkCCoJgkpCduH0K8XIiAKmVATNbOvZ92GboM5eUV/f6nK7XXsthK6fBEElQVBJEFQStimmfnJGdT/z1LuRdi94ZpoW1DMe8qodBDPb85PZoxbPXuPs0wt1/SQIKgmCSoKgknB61T/yn+3ZOwhWvMlu5XWedeaoyPbDU7fbmh0EVx4Keoc393FpgkqCoJIgqCQkiqkKBdg8h4M6aihit+uM+uzd1hg8a/cdELp+EgSVBEElQVBJOFxMlSra3Q4sW3HvZhdHl93XXzdyjtvagz/p+kkQVBIElQRBJUExNcjKnQuz7dCeaWf4zzbrVYavXv8VM6v7VecqzKLrJ0FQSRBUEgSVhGlVf2lh8Cr1ff1nMjz1wMzdCFcI10i6fhIElQRBJUFQSVBMPVA5238ns6a2BfU2pipf+ebB2dfZga6fBEElQVBJEFQSFFO3+Wf7f+oowZmFmaA+sNMK/LPflPe3zz779EJdPwmCSoKgkiCoJCimHqifwrdqB8GM+zYtqKUhmZlz6ztatQbgnfuj6ydBUEkQVBIElYQhxVR1Me5os3cE1O/zd+23wv9Nq+bWX/ncEX8IK9cSHKHrJ0FQSRBUEgSVhPtXZd6PS/ONSoKgkiCoJAgqCYJKgqCSIKgkCCoJgkrCb0wluurXvo9yAAAAAElFTkSuQmCC'></krwidget>

I am looking for an option to write directly to a file such as qrc-my-link.png then I can save the file on my server, and call it from database whenever needed.

Is standard practice to simply output for viewing every time it is called? I am giving my customers the option to choose one of three sizes to use in their advertising.

David Winterburn commented on Mar 11, 2020

Hi Jim,

Please send us an email to support@koolphp.net. We will send you a development version of the Barcode package which should support outputting barcodes and qrcodes directly to files in multiple formats. Thanks!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

BarCode