This commit is contained in:
smiley
2023-03-12 02:57:26 +01:00
parent f312ade552
commit 7aac024a56
5 changed files with 22 additions and 22 deletions
+2 -2
View File
@@ -39,8 +39,8 @@ class MyCustomOutput extends QROutputAbstract{
// invoke the QROutputInterface manually
$options = new QROptions([
'version' => 5,
'eccLevel' => QRCode::ECC_L,
'version' => 5,
'eccLevel' => QRCode::ECC_L,
]);
$qrOutputInterface = new MyCustomOutput($options, (new QRCode($options))->getMatrix('https://www.youtube.com/watch?v=dQw4w9WgXcQ'));
+4 -4
View File
@@ -12,10 +12,10 @@ use chillerlan\QRCode\Data\QRMatrix;
require_once '../vendor/autoload.php';
$options = new QROptions([
'version' => 5,
'outputType' => QRCode::OUTPUT_MARKUP_HTML,
'cssClass' => 'qrcode',
'eccLevel' => QRCode::ECC_L,
'version' => 5,
'outputType' => QRCode::OUTPUT_MARKUP_HTML,
'cssClass' => 'qrcode',
'eccLevel' => QRCode::ECC_L,
'moduleValues' => [
// finder
(QRMatrix::M_FINDER << 8) => '#A71111', // dark (true)
+4 -4
View File
@@ -94,10 +94,10 @@ class QRImageWithText extends QRImage{
$options = new QROptions([
'version' => 7,
'outputType' => QRCode::OUTPUT_IMAGE_PNG,
'scale' => 3,
'imageBase64' => false,
'version' => 7,
'outputType' => QRCode::OUTPUT_IMAGE_PNG,
'scale' => 3,
'imageBase64' => false,
]);
+4 -4
View File
@@ -79,18 +79,18 @@ try{
$qrcode = '<pre style="font-size: 75%; overflow-x: auto;">'.$qrcode.'</pre>';
}
send_response(['qrcode' => $qrcode]);
sendResponse(['qrcode' => $qrcode]);
}
// Pokémon exception handler
catch(\Exception $e){
catch(Exception $e){
header('HTTP/1.1 500 Internal Server Error');
send_response(['error' => $e->getMessage()]);
sendResponse(['error' => $e->getMessage()]);
}
/**
* @param array $response
*/
function send_response(array $response){
function sendResponse(array $response){
header('Content-type: application/json;charset=utf-8;');
echo json_encode($response);
exit;
+8 -8
View File
@@ -16,14 +16,14 @@ require_once __DIR__.'/../vendor/autoload.php';
$gzip = true;
$options = new QROptions([
'version' => 7,
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
'imageBase64' => false,
'eccLevel' => QRCode::ECC_L,
'version' => 7,
'outputType' => QRCode::OUTPUT_MARKUP_SVG,
'imageBase64' => false,
'eccLevel' => QRCode::ECC_L,
'svgViewBoxSize' => 530,
'addQuietzone' => true,
'svgOpacity' => 1.0,
'svgDefs' => '
'addQuietzone' => true,
'svgOpacity' => 1.0,
'svgDefs' => '
<linearGradient id="g2">
<stop offset="0%" stop-color="#39F" />
<stop offset="100%" stop-color="#F3F" />
@@ -33,7 +33,7 @@ $options = new QROptions([
<stop offset="100%" stop-color="#39F" />
</linearGradient>
<style>rect{shape-rendering:crispEdges}</style>',
'moduleValues' => [
'moduleValues' => [
// finder
(QRMatrix::M_FINDER << 8) => 'url(#g1)', // dark (true)
(QRMatrix::M_FINDER_DOT << 8) => 'url(#g1)',