Menu

No Implementing QR Correctly

Alan Moss
2012-09-17
2023-11-11
  • Alan Moss

    Alan Moss - 2012-09-17

    Hi all….

    Is it only me who has realised that the QR codes aren't configured correctly using this script?  The 'Size' attribute (1 to 40) just seems to adjust the amount of pixels used for each row / column, rather than adjust the "amount" or rows /columns like its supposed to do.

    If I choose size 1, as per the spec. I am expecting a QR code that is 21x21 (rowsXcolumns), not a teeny tiny QR code that has each row / column set to 1 pixel…. In theory I should be able to set the width and height of each row/column by stating the overall size of the QR code I would like.

    As it stands I cannot set the amount of rows and columns, and I cannot set the overall size of the QR code.

    Has anyone else come across this? Or better still overcome it?

    Cheers
    Alan

     
  • Albert Hart

    Albert Hart - 2023-11-11

    It turns out that the size of the image is controlled by the outerFrame parameter when calling the image

    // public static function png($frame, $filename = false, 
    //      $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE)
    
    
        $pixels_per_point = 4;
        $outer_frame = 8; // determines the size of the image
        // use 6 or 8 for larger images
    
        $codeContents = "content for QR code";
    
        $fileName = '005_file_'.md5($codeContents).'.png';
    
        QRcode::png($codeContents, $pngAbsoluteFilePath,
                $pixels_per_point, $outer_frame);
    
     

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.