Reputation: 133
I'm trying to get a QR code working.
when i run it like:
<?php
include 'phpqrcode/qrlib.php';
QRcode::png('hwllo');
?>
it's working. However if i run it with some other php code
<?php
include 'phpqrcode/qrlib.php';
echo 'Hello world';
QRcode::png('hwllo');
?>
it displays:
Hello world‰PNG IHDRWWKK/PLTEÿÿÿUÂÓ~²IDAT8ÍÒ1„ Ðo(èô&^ƒŽ+0r¸× ávÆYbÖÝ-phêM÷ùð´ˆLHD‘qá‚XÁZ'ç“Ë › š¶H CX™¾ª.ùú½¥êsUT<±eqhÖy|áÓÃ;š¶¼wž3d„D8÷ŠÈ—*ÀøÌEEÆgãL\ú4a_ÀZ§UŠãúw¶35l|ìër_Lë•¡ê’ßQœçgÍü#Ãò¡IEND®B
‚
Upvotes: 1
Views: 2430
Reputation: 15045
You can't put text like that inside an image, it will make it malformed/corrupted and not display. Use your previous code and do no echo anything out inside the image. If you need to put text next to the image use HTML and link to the QR image file using an IMG tag as you would a normal image file for an HTML page.
Upvotes: 3