:octocat: examples cleanup

This commit is contained in:
smiley
2022-07-09 18:10:23 +02:00
parent 9d309e2ff8
commit e971678ac5
17 changed files with 382 additions and 420 deletions
+10 -9
View File
@@ -6,23 +6,19 @@
* @license MIT
*/
namespace chillerlan\QRCodeExamples;
use chillerlan\QRCode\{QRCode, QROptions};
use chillerlan\QRCode\Common\EccLevel;
use chillerlan\QRCode\Data\QRMatrix;
require_once __DIR__.'/../vendor/autoload.php';
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$options = new QROptions([
'version' => 7,
'outputType' => QRCode::OUTPUT_EPS,
'eccLevel' => EccLevel::L,
'scale' => 5,
'addQuietzone' => true,
'cachefile' => __DIR__.'/test.eps',
# 'cachefile' => __DIR__.'/test.eps', // save to file
'moduleValues' => [
// finder
QRMatrix::M_FINDER | QRMatrix::IS_DARK => 0xA71111, // dark (true)
@@ -52,11 +48,16 @@ $options = new QROptions([
],
]);
// if viewed in the browser, we should push it as file download as EPS isn't usually supported
header('Content-type: application/postscript');
header('Content-Disposition: filename="qrcode.eps"');
echo (new QRCode($options))->render($data);
if(php_sapi_name() !== 'cli'){
// if viewed in the browser, we should push it as file download as EPS isn't usually supported
header('Content-type: application/postscript');
header('Content-Disposition: filename="qrcode.eps"');
}
echo (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
exit;