Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to get mime type image/png returned in the base64 output #272

thammer67 started this conversation in General
Discussion options

I am trying to use php-qrcode to generate a base64 encoded PNG that I can pass to FPDF's Image() function as I need to include a QR code in a large PDF I am generating.

I have tried to follow the QRGdImage example (among others) to generate the string but no matter what I try, it always comes back with 'data:image/svg+xml' and FPDF complains saying "FPDF error: Not a PNG file".

I am using PHP 8.2.5 and php-qrcode 5.0.2 on Debian 12 (Bookworm)

How can I get php-qrcode to return "data:image/png" so I can accomplish this?

Thanks!

You must be logged in to vote

Replies: 2 comments

Comment options

Hi, it appears you're using examples from the main/dev branch, instead of the ones for your installed version, see the bold text over here: https://github.com/chillerlan/php-qrcode?tab=readme-ov-file#documentation

You must be logged in to vote
0 replies
Comment options

Sorry. I missed that bit. I mistakenly assumed the latest release branch would contain the lastest code commits.

I removed php-qrcode and installed dev-main#0ca3d2377f8d01b788c738d46f9bf72d9b17083d (which is the latest commit in main) and it's now working fine. Thanks!

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /