PHP QRcode how to do to make it bigger

1

I am generating a QRcode through the phpqrcode lib. I know it has the sizes L , H and others. But, are there ways to make the image larger using other settings? For even in%% is small for my need.

Here's my code

require_once "phpqrcode/qrlib.php";

  $code =  $qr;

  QRcode::png($code, "Imagem_QRCODE_H.png", QR_ECLEVEL_H);

  echo '<img src="Imagem_QRCODE_H.png"/>';
    
asked by anonymous 14.11.2017 / 12:25

1 answer

1

In the documentation there seems to be something about setting the zoom size of the pixels. I imagine it will solve your problem.

    include('../lib/full/qrlib.php'); 
    include('config.php'); 

    // how to configure pixel "zoom" factor 

    $tempDir = EXAMPLE_TMP_SERVERPATH; 

    $codeContents = '123456DEMO'; 

    // generating 
    QRcode::png($codeContents, $tempDir.'007_1.png', QR_ECLEVEL_L, 1); 
    QRcode::png($codeContents, $tempDir.'007_2.png', QR_ECLEVEL_L, 2); 
    QRcode::png($codeContents, $tempDir.'007_3.png', QR_ECLEVEL_L, 3); 
    QRcode::png($codeContents, $tempDir.'007_4.png', QR_ECLEVEL_L, 4); 

    // displaying 
    echo '<img src="'.EXAMPLE_TMP_URLRELPATH.'007_1.png" />'; 
    echo '<img src="'.EXAMPLE_TMP_URLRELPATH.'007_2.png" />'; 
    echo '<img src="'.EXAMPLE_TMP_URLRELPATH.'007_3.png" />'; 
    echo '<img src="'.EXAMPLE_TMP_URLRELPATH.'007_4.png" />'; 

Output:

  

Documentation

Note : : I ran a test and realized that the image does not seem to be overwritten when a new one is generated with the same name, so for testing purposes, generated image previously or simply generate a dynamic name with a hash for example:

$nameImg = md5(date('d-m-Y')).'.png';
QRcode::png($codeContents, $tempDir.$nameImg, QR_ECLEVEL_L, 5); 
echo '<img src="'.EXAMPLE_TMP_URLRELPATH.$nameImg'" />';
    
14.11.2017 / 12:49