Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to suppress output of generated QR code. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WAS33M
Copy link

@WAS33M WAS33M commented Apr 14, 2024

Usage Before:

 $qr_factory = QRcode::factory()->setCode($generatedString)->setFile($qr_file_path);
 $qr_factory->getQRcodePngData();

Usage After this PR:

1: QRcode::png($generatedString, null, $qr_file_path, null, null, null, null, true);
2: QRcode::factory()->setCode($generatedString)->setFile($qr_file_path)->setSkipOutput(true)->renderPNG();

This change allows the QR code generation function to save the QR code image to a file without sending any output to the browser or client.

Reason:
An absolute path was needed for rendering the barcode in a PDF using the PHP mPDF library. However, the Barcode library was also outputting content to the browser with an echo statement. This PR suppresses the echo statement, allowing only the file to be saved."

Usage Before:
 $qr_factory = QRcode::factory()->setCode($generatedString)->setFile($qr_file_path);
 $qr_factory->getQRcodePngData();

Usage After this PR:
 QRcode::png($generatedString, null, $qr_file_path, null, null, null, null, true);

This change allows the QR code generation function to save the QR code image to a file without sending any output to the browser or client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant