From 87fa4d055c9bba8c2975adcf1672fec3f72ee065 Mon Sep 17 00:00:00 2001 From: Felix Eckhofer Date: Sun, 10 Aug 2014 20:16:52 +0200 Subject: [PATCH] Use correct method to extract image from vcard It was incorrectly assumed, that $vcard is always an OCA\Contacts\Contact (which is true when the contacts app is rendered) but when called from the `contactUpdated` hook, it actually is a OCA\Contacts\VObject\VCard. Fixes owncloud/contacts#585 --- lib/utils/properties.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils/properties.php b/lib/utils/properties.php index 54365b8e..6f30c79d 100644 --- a/lib/utils/properties.php +++ b/lib/utils/properties.php @@ -311,8 +311,8 @@ Class Properties { $app = new App(); $vcard = $app->getContact($backendName, $addressBookId, $contactId); } - $image = $vcard->getPhoto(); - if (is_null($image)) { + $image = new \OCP\Image(); + if (!isset($vcard->PHOTO) || !$image->loadFromBase64((string)$vcard->PHOTO)) { return false; } }