1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-18 07:52:21 +01:00

Set raw photo data into vcard - encoding is done with the serialization mechanisms - fix #904 #787

This commit is contained in:
Thomas Müller 2015-06-30 10:26:09 +02:00
parent 513b1d6875
commit 09150e057c

View File

@ -43,7 +43,7 @@ class Contact extends VObject\VCard implements IPIMObject {
/**
* @brief language object
*
* @var OC_L10N
* @var \OCP\IL10N
*/
public static $l10n;
@ -429,24 +429,10 @@ class Contact extends VObject\VCard implements IPIMObject {
$type = strtoupper(array_pop($type));
}
if (isset($this->PHOTO)) {
$property = $this->PHOTO;
if (!$property) {
return false;
$this->remove('PHOTO');
}
$property->setValue(strval($photo));
$property->parameters = array();
$property->parameters[]
= new \Sabre\VObject\Parameter('ENCODING', 'b');
$property->parameters[]
= new \Sabre\VObject\Parameter('TYPE', $photo->mimeType());
$this->PHOTO = $property;
} else {
$this->add('PHOTO',
strval($photo), array('ENCODING' => 'b',
'TYPE' => $type));
// TODO: Fix this hack
$this->add('PHOTO', $photo->data(), ['ENCODING' => 'b', 'TYPE' => $type]);
$this->setSaved(false);
}
return true;