upd: User
vCard profile * Add profile image to vCard
This commit is contained in:
parent
2e41c1ed83
commit
6468e77445
@ -418,6 +418,18 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
public function generateVCard(): string
|
public function generateVCard(): string
|
||||||
{
|
{
|
||||||
list($fname, $lname) = explode(' ', $this->name, 2);
|
list($fname, $lname) = explode(' ', $this->name, 2);
|
||||||
|
$b64image = null;
|
||||||
|
$fileExt = null;
|
||||||
|
|
||||||
|
if ($this->imageName) {
|
||||||
|
$fullFileName = dirname(dirname(__DIR__))."/public/{$_ENV['USER_IMAGE_PATH']}/{$this->imageName}";
|
||||||
|
$fileExt = strtoupper(pathinfo($fullFileName, PATHINFO_EXTENSION));
|
||||||
|
|
||||||
|
$b64image = base64_encode(
|
||||||
|
file_get_contents($fullFileName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return 'BEGIN:VCARD' .
|
return 'BEGIN:VCARD' .
|
||||||
"\nVERSION:3.0" .
|
"\nVERSION:3.0" .
|
||||||
"\nN:{$lname};{$fname}" .
|
"\nN:{$lname};{$fname}" .
|
||||||
@ -426,6 +438,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|||||||
($this->workPhone ? "\nTEL;TYPE=WORK,VOICE:$this->workPhone" : null) .
|
($this->workPhone ? "\nTEL;TYPE=WORK,VOICE:$this->workPhone" : null) .
|
||||||
($this->email ? "\nEMAIL;TYPE=WORK,INTERNET:$this->email" : null) .
|
($this->email ? "\nEMAIL;TYPE=WORK,INTERNET:$this->email" : null) .
|
||||||
"\nREV:" . date('c') .
|
"\nREV:" . date('c') .
|
||||||
|
($this->imageName ? "\nPHOTO;TYPE={$fileExt};ENCODING=b:{$b64image}" : null) .
|
||||||
"\nEND:VCARD";
|
"\nEND:VCARD";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user