Menu

#14 how to merge qrcode into another image

v1.0 (example)
open
nobody
None
5
2016-12-02
2016-12-02
STC
No

Hello, I am trying to create a new image using a background image and the qrcode. I dont want to have to write the qrcode into the file system. PHP has an imagecreatefromstring, I think that will work, but I need a way to get the actual data of th qr an not ECHO it to the browser.

$im_template = imagecreatefrompng("assets/background.png");
$im_qrcode = imagecreatefromstring( QRcode::png('1234')); //HOW??
imagecopymerge($im_template, $im_qrcode, 10, 10, 0, 0, 100, 47, 75);

Discussion

  • STC

    STC - 2016-12-02

    This seem to work, I hope there is a better way
    ob_start();
    QRcode::png('Hello');
    $qrcodeContent = ob_get_contents();
    ob_end_clean();

     
  • STC

    STC - 2016-12-02

    Unfortunately my prev. solution with the ob_start causes weird problems.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.