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:
parent
270bab8a18
commit
6fd8405f6e
@ -1612,7 +1612,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
* Set a thumbnail for the contact if a PHOTO property exists
|
* Set a thumbnail for the contact if a PHOTO property exists
|
||||||
*/
|
*/
|
||||||
Contact.prototype.setThumbnail = function($elem, refresh) {
|
Contact.prototype.setThumbnail = function($elem, refresh) {
|
||||||
if(!this.data.thumbnail && !refresh) {
|
if(!this.data.photo && !refresh) {
|
||||||
this.getListItemElement().find('.avatar').css('height', '32px');
|
this.getListItemElement().find('.avatar').css('height', '32px');
|
||||||
var name = String(this.getDisplayName()).replace(' ', '').replace(',', '');
|
var name = String(this.getDisplayName()).replace(' ', '').replace(',', '');
|
||||||
this.getListItemElement().find('.avatar').imageplaceholder(name || '#');
|
this.getListItemElement().find('.avatar').imageplaceholder(name || '#');
|
||||||
@ -1624,9 +1624,17 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
if(!$elem.hasClass('thumbnail') && !refresh) {
|
if(!$elem.hasClass('thumbnail') && !refresh) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.data.thumbnail) {
|
if(this.data.photo) {
|
||||||
$elem.removeClass('thumbnail').find('.avatar').remove();
|
$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 {
|
} else {
|
||||||
$elem.addClass('thumbnail');
|
$elem.addClass('thumbnail');
|
||||||
$elem.removeAttr('style');
|
$elem.removeAttr('style');
|
||||||
|
@ -91,13 +91,6 @@ class JSONSerializer {
|
|||||||
|
|
||||||
if(isset($contact->PHOTO) || isset($contact->LOGO)) {
|
if(isset($contact->PHOTO) || isset($contact->LOGO)) {
|
||||||
$details['photo'] = true;
|
$details['photo'] = true;
|
||||||
$details['thumbnail'] = Properties::cacheThumbnail(
|
|
||||||
$contact->getBackend()->name,
|
|
||||||
$contact->getParent()->getId(),
|
|
||||||
$contact->getId(),
|
|
||||||
null,
|
|
||||||
$contact
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($contact->children as $property) {
|
foreach($contact->children as $property) {
|
||||||
|
Loading…
Reference in New Issue
Block a user