1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Simply load the thumbnail as small photo - fixes #936

This commit is contained in:
Thomas Müller 2015-06-30 00:00:18 +02:00
parent 270bab8a18
commit 6fd8405f6e
2 changed files with 11 additions and 10 deletions

View File

@ -1612,7 +1612,7 @@ OC.Contacts = OC.Contacts || {};
* Set a thumbnail for the contact if a PHOTO property exists
*/
Contact.prototype.setThumbnail = function($elem, refresh) {
if(!this.data.thumbnail && !refresh) {
if(!this.data.photo && !refresh) {
this.getListItemElement().find('.avatar').css('height', '32px');
var name = String(this.getDisplayName()).replace(' ', '').replace(',', '');
this.getListItemElement().find('.avatar').imageplaceholder(name || '#');
@ -1624,9 +1624,17 @@ OC.Contacts = OC.Contacts || {};
if(!$elem.hasClass('thumbnail') && !refresh) {
return;
}
if(this.data.thumbnail) {
if(this.data.photo) {
$elem.removeClass('thumbnail').find('.avatar').remove();
$elem.css('background-image', 'url(data:image/png;base64,' + this.data.thumbnail + ')');
var contactId = this.id || 'new',
backend = this.metadata.backend,
addressBookId = this.metadata.parent;
var url = OC.generateUrl(
'apps/contacts/addressbook/{backend}/{addressBookId}/contact/{contactId}/photo?maxSize=32',
{backend: backend, addressBookId: addressBookId, contactId: contactId}
);
$elem.css('background-image', 'url(' + url + ')');
} else {
$elem.addClass('thumbnail');
$elem.removeAttr('style');

View File

@ -91,13 +91,6 @@ class JSONSerializer {
if(isset($contact->PHOTO) || isset($contact->LOGO)) {
$details['photo'] = true;
$details['thumbnail'] = Properties::cacheThumbnail(
$contact->getBackend()->name,
$contact->getParent()->getId(),
$contact->getId(),
null,
$contact
);
}
foreach($contact->children as $property) {