
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
// Avoid BOM/whitespace before headers:
ob_start();
header('Content-Type: text/vcard; charset=utf-8');         // iOS/Android friendly
header('Content-Disposition: attachment; filename="Khalid_Ibrahim.vcf"');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');


// File path of the photo on your server
$imagePath = "https://vcard.core3.agency/khalid/image.jpg"; // change this to your image path
$imageType = pathinfo($imagePath, PATHINFO_EXTENSION); // jpg, png, etc.

// Encode the image to Base64
$imageData = base64_encode(file_get_contents($imagePath));

// Split into 75-char chunks per vCard spec
$base64Chunks = chunk_split($imageData, 75, "\r\n ");


// Build the vCard (use CRLF line breaks per spec)
$nl = "\r\n";
$vcard  = 'BEGIN:VCARD' . $nl;
$vcard .= 'VERSION:3.0' . $nl;
$vcard .= 'N:Ibrahim;Khalid;;;' . $nl;
$vcard .= 'FN:Khalid Ibrahim' . $nl;
$vcard .= 'ORG:CORE3 Consultancy' . $nl;
$vcard .= 'TITLE:Principal & General Manager' . $nl;
$vcard .= "PHOTO;ENCODING=b;TYPE=" . strtoupper($imageType) . ":" . $nl . " " . $base64Chunks;
$vcard .= 'TEL;TYPE=CELL,VOICE:+966554644115' . $nl;
$vcard .= 'TEL;TYPE=WORK,VOICE:+966126404444' . $nl;
$vcard .= 'ADR;TYPE=WORK:;;King Abdullah Street;Jeddah;Makkah;21411;Saudi Arabia' . $nl;
$vcard .= 'EMAIL;TYPE=WORK:khalid.ibrahim@core3consultancy.com' . $nl;
$vcard .= 'URL;TYPE=WORK:https://core3consultancy.com' . $nl;
$vcard .= 'X-SOCIALPROFILE;TYPE=linkedin:https://www.linkedin.com/company/core-3/' . $nl;
$vcard .= 'REV:20251002T120000Z' . $nl;
$vcard .= 'END:VCARD' . $nl;

header('Content-Length: ' . strlen($vcard));
echo $vcard;
ob_end_flush();
exit;

?>