mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Fix import of vCard photos with ENCODING=BASE64
This commit is contained in:
parent
711ca55433
commit
e3d6e09922
@ -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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,8 +121,8 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
|||||||
// Failures
|
// Failures
|
||||||
$this->errors = array();
|
$this->errors = array();
|
||||||
|
|
||||||
// Fix for Apple Addressbook
|
// Fix for Apple Addressbook
|
||||||
$vCard = preg_replace('/item\d\.(ADR|TEL|EMAIL|URL)/', '\1', stream_get_contents($_stream));
|
$vCard = preg_replace('/item\d\.(ADR|TEL|EMAIL|URL)/', '\1', stream_get_contents($_stream));
|
||||||
|
|
||||||
$contacts = new egw_ical_iterator($vCard, '', $charset, array($this, '_vcard'),array(
|
$contacts = new egw_ical_iterator($vCard, '', $charset, array($this, '_vcard'),array(
|
||||||
// Owner (addressbook)
|
// Owner (addressbook)
|
||||||
@ -272,7 +272,7 @@ class addressbook_import_vcard implements importexport_iface_import_plugin {
|
|||||||
foreach($this->preview_records as $i => $record)
|
foreach($this->preview_records as $i => $record)
|
||||||
{
|
{
|
||||||
// Convert to human-friendly
|
// Convert to human-friendly
|
||||||
importexport_export_csv::convert($record,$record_class::$types,$_definition->application);
|
importexport_export_csv::convert($record,$record_class::$types,$_definition->application);
|
||||||
$record = $record->get_record_array();
|
$record = $record->get_record_array();
|
||||||
$row = array();
|
$row = array();
|
||||||
foreach($labels as $field => $label)
|
foreach($labels as $field => $label)
|
||||||
@ -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]);
|
||||||
}
|
}
|
||||||
|
@ -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':
|
||||||
|
Loading…
Reference in New Issue
Block a user