I'm new to PHP & would like to use PHP QR Code library from http://sourceforge.net/projects/phpqrcode/ I download zip file but don't know where to put these contents in Linux for my PHP to recognize.
Can I keep them anywhere or whats the good practice on where to put them & install?
Thanks
From the INSTALL file, it seems as easy as:
unzip the files in your lib folder (/var/www/lib/qrlib for instance)
From the PHP page, include the qrlib file
And you are done
Here is an example of code that should work if your PHP page is in the /var/www folder. Write this code in the /var/www/qrtest.php file, and try to access it from your browser.
<?php
//include only that one, rest required files will be included from it
include "./lib/qrlib/qrlib.php"
//write code into file, Error corection lecer is lowest, L (one form: L,M,Q,H)
//each code square will be 4x4 pixels (4x zoom)
//code will have 2 code squares white boundary around
QRcode::png('PHP QR Code :)', 'test.png', 'L', 4, 2);
//same as above but outputs file directly into browser (with appr. header etc.)
//all other settings are default
//WARNING! it should be FIRST and ONLY output generated by script, otherwise
//rest of output will land inside PNG binary, breaking it for sure
QRcode::png('PHP QR Code :)');
//show benchmark
QRtools::timeBenchmark();
//rebuild cache
QRtools::buildCache();
//code generated in text mode - as a binary table
//then displayed out as HTML using Unicode block building chars :)
$tab = $qr->encode('PHP QR Code :)');
QRspec::debug($tab, true);
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With