I'm using PHP QR Code library to generate QR codes.
I included the library and after fetching user information from database, I am trying to create qrcode. And then return the path of the generated qrcode to the front end so that I can pass it to an image tag for showing it to users.
I am fetching name, id,email and user image path from database. I want to include user image to the qrcode, so I get the contents and encode it as string.
I'm not getting errors. I checked the folder, qrcode is not being saved.
require_once 'externalLibraries/qrcode/qrlib.php';
 // how to build raw content - QRCode with Business Card (VCard) + photo         
 $tempDir = QRCODE_PATH; //saves temporary directory path
 // we building raw data 
 $codeContents  = 'BEGIN:VCARD'."\n"; 
 $codeContents .= 'FN:'.$name."\n"; 
 $codeContents .= 'ID:'.$id."\n"; 
 $codeContents .= 'EMAIL:'.$email."\n"; 
 $codeContents .= 'PHOTO;JPEG;ENCODING=BASE64:'.base64_encode(file_get_contents('../'.$userAvatar))."\n"; 
 $codeContents .= 'END:VCARD'; 
 // generating 
 QRcode::png($codeContents, $tempDir.$clientid.'.png', 4, 3); 
 // displaying 
 return QRCODE_PATH.$clientid.'.png'; 
Is this the way to generate qrcodes?
 
     
    