mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-11-29 11:24:11 +01:00
Contacts: Use correct TYPE parameter when saving PHOTO.
This commit is contained in:
parent
771e440b5c
commit
3759c2d02e
@ -89,9 +89,13 @@ if($data) {
|
|||||||
OCP\Util::writeLog('contacts',
|
OCP\Util::writeLog('contacts',
|
||||||
'savecrop.php: files: Adding PHOTO property.',
|
'savecrop.php: files: Adding PHOTO property.',
|
||||||
OCP\Util::DEBUG);
|
OCP\Util::DEBUG);
|
||||||
|
// NOTE: For vCard 3.0 the type must be e.g. JPEG or PNG
|
||||||
|
// For version 4.0 the full mimetype should be used.
|
||||||
|
// https://tools.ietf.org/html/rfc2426#section-3.1.4
|
||||||
|
$type = strtoupper(array_pop(explode('/', $image->mimeType())));
|
||||||
$vcard->addProperty('PHOTO',
|
$vcard->addProperty('PHOTO',
|
||||||
$image->__toString(), array('ENCODING' => 'b',
|
$image->__toString(), array('ENCODING' => 'b',
|
||||||
'TYPE' => $image->mimeType()));
|
'TYPE' => $type));
|
||||||
}
|
}
|
||||||
$now = new DateTime;
|
$now = new DateTime;
|
||||||
$vcard->setString('REV', $now->format(DateTime::W3C));
|
$vcard->setString('REV', $now->format(DateTime::W3C));
|
||||||
|
Loading…
Reference in New Issue
Block a user