endroid / qr-code

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

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

Closed Brice155 closed 6 months ago

Brice155 commented 6 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 6 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 5 months ago

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