From 19b1fa25aa0d82295445db8796032e2b9b8990b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 30 Jun 2015 13:04:27 +0200 Subject: [PATCH] When loading the image from the VCard we get the raw binary data - no need to base64 encode anything anymore --- lib/contact.php | 4 ++-- lib/controller/importcontroller.php | 1 - lib/utils/temporaryphoto/contact.php | 4 ++-- lib/vobject/vcard.php | 16 ++++++++-------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/contact.php b/lib/contact.php index e25a97c8..53ebe617 100644 --- a/lib/contact.php +++ b/lib/contact.php @@ -407,9 +407,9 @@ class Contact extends VObject\VCard implements IPIMObject { public function getPhoto() { $image = new \OCP\Image(); - if (isset($this->PHOTO) && $image->loadFromBase64((string)$this->PHOTO)) { + if (isset($this->PHOTO) && $image->loadFromData($this->PHOTO->getValue())) { return $image; - } elseif (isset($this->LOGO) && $image->loadFromBase64((string)$this->LOGO)) { + } elseif (isset($this->LOGO) && $image->loadFromData($this->LOGO->getValue())) { return $image; } diff --git a/lib/controller/importcontroller.php b/lib/controller/importcontroller.php index 02667ddd..63f22de2 100644 --- a/lib/controller/importcontroller.php +++ b/lib/controller/importcontroller.php @@ -181,7 +181,6 @@ class ImportController extends Controller { return $response; } $view = \OCP\Files::getStorage('contacts'); - $file = $view->file_get_contents('/imports/' . $filename); $importManager = new ImportManager(); diff --git a/lib/utils/temporaryphoto/contact.php b/lib/utils/temporaryphoto/contact.php index 2d61a179..61bf728b 100644 --- a/lib/utils/temporaryphoto/contact.php +++ b/lib/utils/temporaryphoto/contact.php @@ -34,7 +34,7 @@ class Contact extends BaseTemporaryPhoto { /** * The Contact object to load the image from * - * @var OCA\Contacts\Contact + * @var \OCA\Contacts\Contact */ protected $contact; @@ -59,4 +59,4 @@ class Contact extends BaseTemporaryPhoto { $this->image = $this->contact->getPhoto(); } -} \ No newline at end of file +} diff --git a/lib/vobject/vcard.php b/lib/vobject/vcard.php index bedb56c5..c4c9679e 100644 --- a/lib/vobject/vcard.php +++ b/lib/vobject/vcard.php @@ -39,14 +39,14 @@ use Sabre\VObject; * @property \OC\VObject\CompoundProperty ORG * @property \OC\VObject\CompoundProperty ADR * @property \OCA\Contacts\VObject\GroupProperty CATEGORIES - * @property \OC\VObject\StringProperty FN - * @property \OC\VObject\StringProperty EMAIL - * @property \OC\VObject\StringProperty VERSION - * @property \OC\VObject\StringProperty BDAY - * @property \OC\VObject\StringProperty UID - * @property \OC\VObject\StringProperty REV - * @property \OC\VObject\StringProperty PHOTO - * @property \OC\VObject\StringProperty LOGO + * @property \Sabre\VObject\Property\Text FN + * @property \Sabre\VObject\Property\Text EMAIL + * @property \Sabre\VObject\Property\Text VERSION + * @property \Sabre\VObject\Property\Text BDAY + * @property \Sabre\VObject\Property\Text UID + * @property \Sabre\VObject\Property\Text REV + * @property \Sabre\VObject\Property\Binary PHOTO + * @property \Sabre\VObject\Property\Binary LOGO */ class VCard extends VObject\Component\VCard {