Fix import of vCard photos with ENCODING=BASE64

This commit is contained in:
Nathan Gray 2015-09-23 17:39:55 +00:00
parent 711ca55433
commit e3d6e09922
3 changed files with 10 additions and 8 deletions

View File

@ -78,8 +78,7 @@ class addressbook_egw_record implements importexport_iface_egw_record
* @return array complete record as associative array
*/
public function get_record_array() {
// do not return binary jpeg, it messes up json data
return array_diff_key($this->contact, array('jpegphoto' => true));
return $this->contact;
}
/**

View File

@ -282,7 +282,7 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
// Don't scare users, do something with jpeg
if($field == 'jpegphoto' && $row[$field])
{
$row[$field] = '<span style="white-space: nowrap;">-ENCODED IMAGE-</span>';
$row[$field] = '<img style="max-width:50px;max-height:50px;" src="data:image/jpeg;base64,'.$row[$field].'"/>';
}
unset($record[$field]);
}

View File

@ -953,8 +953,11 @@ class addressbook_vcal extends addressbook_bo
break;
case 'jpegphoto':
$contact[$fieldName] = $vcardValues[$vcardKey]['params']['ENCODING'] == 'b' ?
base64_decode($vcardValues[$vcardKey]['value']): $vcardValues[$vcardKey]['value'];
$contact[$fieldName] = $vcardValues[$vcardKey]['value'];
if(in_array($vcardValues[$vcardKey]['params']['ENCODING'],array('b','B','BASE64')))
{
$contact[$fieldName] = base64_decode($contact[$fieldName]);
}
break;
case 'note':