barcode icon indicating copy to clipboard operation
barcode copied to clipboard

Can't pass "&" in dmtx or qr

Open aculine opened this issue 3 years ago • 1 comments

Hi, I cannot be able to pass url with & in barcode dmtx or qr. If I use %26 (& in urlencode), barcode seams do not draw correcly. I need to pass a url like "https://www.domain.ext/wp-admin/post.php?action=edit&post=123"

Any idea?

Thank you, Luca

aculine avatar Apr 27 '21 07:04 aculine

This library allows to build and display a barcode by calling it directly from your browser. If it seems like a fancy and easy way to produce a barcode. Actually it is a very bad idea. It allows other people than yourself to call build their own barcodes with your code. This is absurd.

You should instead build your barcode from your own script like below. It will also solve your problem.

<?php

require_once('barcode.php');

$generator = new barcode_generator();
$data = 'https://www.domain.ext/wp-admin/post.php?action=edit&post=123';
$format = 'png';
$type = 'qr';
$options = [
	'w' => 600,
	'h' => 600,
];
$generator->output_image($format , $type, $data, $options);


merry-goblin avatar Jan 26 '24 12:01 merry-goblin