Fix import of vCard photos with ENCODING=BASE64

This commit is contained in:
Nathan Gray 2015-09-29 14:43:07 +00:00
parent 6450e343c4
commit 0dd3c78346
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 * @return array complete record as associative array
*/ */
public function get_record_array() { public function get_record_array() {
// do not return binary jpeg, it messes up json data return $this->contact;
return array_diff_key($this->contact, array('jpegphoto' => true));
} }
/** /**

View File

@ -282,7 +282,7 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
// Don't scare users, do something with jpeg // Don't scare users, do something with jpeg
if($field == 'jpegphoto' && $row[$field]) 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]); unset($record[$field]);
} }

View File

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