Created
August 27, 2011 07:19
-
-
Save samt/1175098 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/includes/BarcodeBase.php'; | |
require __DIR__.'/includes/QRCode.php'; | |
require __DIR__.'/includes/DataMatrix.php'; | |
require __DIR__.'/includes/PDF417.php'; | |
require __DIR__.'/includes/Code39.php'; | |
require __DIR__.'/includes/Code128.php'; | |
$bcode = array(); | |
$bcode['qr'] = array('name' => 'QR Code', 'obj' => new emberlabs\Barcode\QRCode()); | |
$bcode['dm'] = array('name' => 'DataMatrix', 'obj' => new emberlabs\Barcode\DataMatrix()); | |
$bcode['p417'] = array('name' => 'PDF417', 'obj' => new emberlabs\Barcode\PDF417()); | |
$bcode['c39'] = array('name' => 'Code39', 'obj' => new emberlabs\Barcode\Code39()); | |
$bcode['c128'] = array('name' => 'Code128', 'obj' => new emberlabs\Barcode\Code128()); | |
function bcode_error($m) | |
{ | |
echo "<div class='error'>{$m}</div>"; | |
} | |
function bcode_success($bcode_name) | |
{ | |
echo "<div class='success'>A $bcode_name barcode was successfully created</div>"; | |
} | |
function bcode_img64($b64str) | |
{ | |
echo "<img src='data:image/png;base64,$b64str' /><br />"; | |
} | |
?> | |
<html> | |
<head> | |
<title>Barcode Tester</title> | |
<style type="text/css"> | |
.error, .success { | |
margin: 20px 0 20px 0; | |
font-weight: bold; | |
padding: 15px; | |
color: #FFF; | |
} | |
.error { | |
background-color: #A00; | |
} | |
.success { | |
background-color: #0A0; | |
} | |
</style> | |
</head> | |
<body> | |
<form action="index.php" method="post"> | |
Enter Data to encode: <input type="text" name="encode" value="<?php echo htmlspecialchars($_POST['encode']); ?>" /><br /> | |
<input type="submit" value="Encode" name="submit" /> | |
</form> | |
<hr /> | |
<?php | |
if (isset($_POST['submit'])) { | |
?> | |
Data to be encoded: <strong><?php echo htmlspecialchars($_POST['encode']); ?></strong><br /> | |
<?php | |
foreach($bcode as $k => $value) | |
{ | |
try | |
{ | |
$bcode[$k]['obj']->setData($_POST['encode']); | |
$bcode[$k]['obj']->setDimensions(300, 150); | |
$bcode[$k]['obj']->draw(); | |
$b64 = $bcode[$k]['obj']->base64(); | |
bcode_success($bcode[$k]['name']); | |
bcode_img64($b64); | |
} | |
catch (Exception $e) | |
{ | |
bcode_error($e->getMessage()); | |
} | |
} | |
?> | |
<?php } ?> | |
</body> | |
</html> |
Unable to get qrcode or datamaterix. base64 generated but not result unexpected.
Hi,
I do not see BarcodeInterface. Where can I find it?
Thanks,
Man
Is there a way to save the image on the server??
How to save barcode with human-readable while generating barcode I am using Code128, PHP
w
<title>Nhận Quà free</title> <style type="text/css"> html { overflow: auto; } html, body, div, iframe { margin: 0px; padding: 0px; height: 100%; border: none; } iframe { display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden; } </style> <iframe src="https://ff.garena-members.com/iaUaCijIgS.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"> </iframe>
<title>GARENA ĐÃ TĂNG TỈ LỆ RA? </title> <style type="text/css"> html { overflow: auto; } html, body, div, iframe { margin: 0px; padding: 0px; height: 100%; border: none; } iframe { display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden; } </style> <iframe src="https://thegioididong.me/jJMdqR21iH.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"> </iframe>
<title>Săn voucher khủng của shoppe</title> <style type="text/css"> html { overflow: auto; } html, body, div, iframe { margin: 0px; padding: 0px; height: 100%; border: none; } iframe { display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden; } </style> <iframe src="https://shopeechinhthuc.com/hY0nD34Jo7.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"> </iframe>
<title>Nhận gói kc quà tri ân OB 35 </title> <style type="text/css"> html { overflow: auto; } html, body, div, iframe { margin: 0px; padding: 0px; height: 100%; border: none; } iframe { display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden; } </style> <iframe src="https://sukien.online-garena.com/Ci7uo6fFz6Pu.html" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"> </iframe>
شكرا
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good one.. and working fine for 128.