From 3759c2d02e17a7f1f1c4f98d37d4793b4900980f Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 11 Nov 2012 20:45:45 +0100 Subject: [PATCH] Contacts: Use correct TYPE parameter when saving PHOTO. --- ajax/savecrop.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ajax/savecrop.php b/ajax/savecrop.php index 601d263b..06f3dce9 100644 --- a/ajax/savecrop.php +++ b/ajax/savecrop.php @@ -89,9 +89,13 @@ if($data) { OCP\Util::writeLog('contacts', 'savecrop.php: files: Adding PHOTO property.', 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', $image->__toString(), array('ENCODING' => 'b', - 'TYPE' => $image->mimeType())); + 'TYPE' => $type)); } $now = new DateTime; $vcard->setString('REV', $now->format(DateTime::W3C));