endroid / qr-code

QR Code Generator
https://endroid.nl
MIT License
4.46k stars 727 forks source link

Question : how is it possible not displaying the label (for accessibility reasons) ? #437

Closed Brice155 closed 10 months ago

Brice155 commented 10 months ago

Hello ! And thanks a lot for this awesome package !

Here is my code : ` $dataToQrCodify = $this->getParameter('app.app.site.root.url.www');

// Create file if it does not exist
if (!file_exists($directory.$filename)) {
    $writer = new PngWriter();
    $qrCode = QrCode::create($dataToQrCodify)
        ->setEncoding(new Encoding('UTF-8'))
        ->setErrorCorrectionLevel(new ErrorCorrectionLevelHigh())
        ->setSize(300)
        ->setMargin(10)
        ->setForegroundColor(new Color(0, 0, 0))
        ->setBackgroundColor(new Color(255, 255, 255));
    $writer->write($qrCode)->saveToFile($directory.$filename);
}`

But the content of the variable $dataToQrCodify is displayed under the QRCode. How can i hide it (for accessibility reasons) ?

Thanks for your answer ;)

Screenshot : 2024-01-11 16_38_43-Window

endroid commented 10 months ago

Hi @Brice155 the text under the QR code is the label which can be set via Label::create($labelText). You are probably calling it from somewhere as QrCode::create($data) does not set this label.

Brice155 commented 10 months ago

Hi @endroid Thanks for your answer... Indeed, the picture was cached... after delete it, the label was not here anymore. Sorry