Browse Source

Improved phonebook photos

Closes #385
master
Igor Zhukov 11 years ago
parent
commit
62046f307f
  1. 11
      app/js/services.js

11
app/js/services.js

@ -320,7 +320,7 @@ angular.module('myApp.services', [])
} }
}) })
.service('PhonebookContactsService', function ($q, $modal, $sce) { .service('PhonebookContactsService', function ($q, $modal, $sce, FileManager) {
var phonebookContactsPromise; var phonebookContactsPromise;
@ -376,9 +376,12 @@ angular.module('myApp.services', [])
contact.phones.push(this.result.tel[i].value); contact.phones.push(this.result.tel[i].value);
} }
} }
if (this.result.photo) { if (this.result.photo && this.result.photo[0]) {
contact.photo = URL.createObjectURL(this.result.photo[0]); try {
} else { contact.photo = FileManager.getUrl(this.result.photo[0]);
} catch (e) {}
}
if (!contact.photo) {
contact.photo = 'img/placeholders/UserAvatar' + ((Math.abs(count) % 8) + 1) + '@2x.png'; contact.photo = 'img/placeholders/UserAvatar' + ((Math.abs(count) % 8) + 1) + '@2x.png';
} }
contact.photo = $sce.trustAsResourceUrl(contact.photo); contact.photo = $sce.trustAsResourceUrl(contact.photo);

Loading…
Cancel
Save