Subject: | Suggestion for smaller HTML footprint |
Date: | Fri, 21 Aug 2020 23:33:36 +0200 |
To: | <bug-HTML-QRCode [...] rt.cpan.org> |
From: | "Sebastian Nielsen" <sebastian [...] sebbe.eu> |
I have a suggestion to make the HTML footprint smaller.
And that is to use a output of:
$arref = $qrcode->plot($qrdata);
$qrtoprint = join "<\/tr><tr>", map { join '', map { $_ eq '*' ?
"<th><\/th>" : "<td><\/td>" } @$_ } @$arref;
$result = "<div id=\"qrcode\"><table><tr>".$qrtoprint."</tr></table></div>";
(where $qrdata is input, $arref is output from Text::QRCode and $result is
the resulting HTML code to print to web page.
BUT, there needs to be added information that this stylesheet needs to be
included, for it to work:
#qrcode table {border-spacing: 0;border: 0;margin: 0;}
#qrcode td {background-color: #FFFFFF;margin: 0;padding: 0;width:
3px;height: 3px;}
#qrcode th {background-color: #000000;margin: 0;padding: 0;width:
3px;height: 3px;}
This will reduce the footprint greatly, so the printed QR code does not take
up so much kB.
The reason to have the CSS separate, is to allow multiple QR codes to be
printed to same webpage.
Best regards, Sebastian Nielsen
Message body not shown because it is not plain text.