mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 20:17:17 +00:00
💄
This commit is contained in:
@@ -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
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
]);
|
||||
|
||||
|
||||
|
||||
@@ -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
@@ -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)',
|
||||
|
||||
Reference in New Issue
Block a user