/** * Get contact photo */ public function getPhoto($size = 40) { if (!isset($this->vcard->PHOTO)) { return false; } else { $image = new Image(base64_encode((string) $this->vcard->PHOTO)); $image->resize($size); return 'data:' . $image->mimeType() . ';base64,' . $image->__toString(); } }