Menu

#19 Business Card with Photo cannot be generate.

v1.0 (example)
open
nobody
None
5
2022-07-28
2022-07-28
Fann Lock
No
$tempDir = "qrcode/temp_img/";
$image_path="qrcode/test.jpg";

$photo = base64_encode(file_get_contents($image_path));

// here our data
$name         = $lastName." ".$EmployeeName;
$sortName     = $EmployeeName.";".$lastName;
$phone        = $PhoneNumber;

$email        = $EmailAddress;

// we building raw data
$codeContents  = 'BEGIN:VCARD'."\n";
$codeContents .= 'VERSION:2.1'."\n";
// $codeContents .= 'N:'.$sortName."\n";
$codeContents .= 'FN:'.$name."\n";

$codeContents .= 'TEL;WORK;VOICE:'.$phone."\n";
$codeContents .= 'EMAIL:'.$email."\n";

$codeContents .= 'PHOTO;JPEG;ENCODING=BASE64:'.$photo."\n";

$codeContents .= 'END:VCARD';

// generating
QRcode::png($codeContents, $tempDir.$EmployeeID.'.png', QR_ECLEVEL_L, 3);

// displaying
echo '<img src="'.$tempDir.$EmployeeID.'.png" />';

I try to include the photo to the qr code business card but it cannot be generate and it gave me an error "Wrong Version".

1 Attachments

Discussion


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.