So, I have Koolreports 5 integrated with CodeIgniter4 and all works fine. However, I want to use tiny pieces of KoolReports in my CI views without the KoolReport View. For example, I want to use a QR Barcode in a piece of javascript that puts locations on a OpenStreetMaps map. I just want the image, not the surrounding KR formatting and javescript.
So I have something like this [Assume controller includes the KR Autoload perfectly] ...
$qrCode = \koolreport\barcode\QRCode::html(array(
"format" => "png",
"value" => "geo:53.1126812,-6.260661",
"size" => 150,
"foregroundColor" => array(0, 0, 0),
"backgroundColor" => array(255, 255, 255),
));
echo $qrReport;
It outputs something like this...
<script type='text/javascript' src='/koolreport_assets/3409401219/KoolReport.js'></script>
<krwidget widget-name='' widget-type='koolreport/barcode/QRCode'>
<img src='data:image/PNG;base64,iVBORw0KGgoAA <** SNIP**> VORK5CYII='>
</krwidget>
Where as I just want the actual image with nothing else. A little like this ...
<img src='data:image/PNG;base64,iVBORw0KGgoAA <** SNIP**> VORK5CYII='>
I got around it by amending the above code to this...
preg_match_all('/<img[^>]+>/i',$qrCode, $image_matches);
echo implode($image_matches[0]);
So, my workaround works for me. I'm just wondering if there is a nicer option. Maybe a flag to QRCode to output just the image?